I wanted to write custom rest api to get all customer's order and details using customer token. I'm able to achieve this by this post.

But it is not loading up my custom extension attribute (Delivery Slot) in the order details api.

Also I need to load the image/thumnail url for each product/item in that order.

Can anyone help me out in this regard?


Please check the below links :

  1. https://store.fooman.co.nz/blog/an-introduction-to-extension-attributes.html
  2. https://devdocs.magento.com/guides/v2.2/extension-dev-guide/extension_attributes/adding-attributes.html
| improve this answer | |

You can add extension attributes in Magento 2 Order data by creating aextension_attributes.xml file under etc folder.

Get insight into extension attributes in Magento 2 by referring blog,

Magento 2 Order Extension Attribute

add code,

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    <extension_attributes for="Magento\Sales\Api\Data\OrderInterface">
        <attribute code="order_comment" type="string" />
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.