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

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" />
  • is there any way to use extension attribute in search criteria for order API? I have created extension attribute which is column in separate table. Everything is working fine but when you try use it in the search criteria for the order i get column not found issue. It is looking in sales_order table but my attribute is a field in custom table. How can i use extension attribute for API search? Please let me know if you know something on this. Jan 19 '21 at 1:33

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.