Categories
CMS Magento Mastering Development

Magento 2 API: Extension Attribute with null value not showing

I’m retrieving from the Magento API an order by its increment_id attribute like this: http://mystore.com/rest/V1/orders?searchCriteria[filter_groups][0][filters][0][field]=increment_id&searchCriteria[filter_groups][0][filters][0][value]=1200040527&searchCriteria[filter_groups][0][filters][0][condition_type]=eq I have added a plugin to add a custom attribute to the Order items like this (etc/di.xml): <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\Sales\Api\OrderRepositoryInterface"> <plugin name="order_custom_extension_attribute" type="MyVendor\Sales\Plugin\OrderRepositoryPlugin"/> </type> </config> And then adding the custom attribute (is_gift_card) to the OrderItem like […]