3

Is it possible to override vendor/magento/module-sales/Api/Data/OrderAddressInterface.php as I want to get sales order address custom column value in order REST API.

Bhaumik Upadhyay
  • 893
  • 1
  • 9
  • 18
user12992122
  • 141
  • 1
  • 11

1 Answers1

3

It's not possible to override the interfaces using the preference. Magento 2 does not allow Third-party developers to change the API Data interfaces defined in the Magento Core code.

Please try to use the Extension attributes to achieve your requirement. Extension attributes extend functionality and often use more complex data types than custom attributes. These attributes do not appear on the GUI.

Please refer to the Magento DevDocs for more information here.

Also, refer to this post with similar question if it helps! Magento 2 : Override core Interface and Model

Bhaumik Upadhyay
  • 893
  • 1
  • 9
  • 18
  • But I'm not able get sales order address custom column value in order REST API. Could you please help me on this – user12992122 Jun 10 '20 at 14:59
  • Please check this post: https://magento.stackexchange.com/questions/235947/how-to-expose-a-custom-field-from-sales-order-table-to-rest-api – Bhaumik Upadhyay Jun 10 '20 at 16:33
  • I want to get the custom attribute value from sales order address table that to in shipping address. I'm using magento 2.3.2 EE – user12992122 Jun 11 '20 at 02:39
  • Friends please help me – user12992122 Jun 11 '20 at 02:41
  • Have you tried to use an extension attribute and get the value of the custom attribute? Check the example here: https://magehit.com/blog/how-to-get-value-of-custom-attribute-on-magento-2-rest-api/ – Bhaumik Upadhyay Jun 12 '20 at 01:41
  • Yes. I tried tis for sales_order table custom attribute and it helped me to get that value. but I'm unable to get the value of shipping address. – user12992122 Jun 12 '20 at 03:47
  • Try this out: https://magento.stackexchange.com/questions/93143/magento2-how-to-get-shipping-address-for-order-in-rest-api – Bhaumik Upadhyay Jun 12 '20 at 03:59
  • Hi Bhaumik, Actually we have a partner vendor they just run order REST API with the search criteria order status in processing. While they run the order REST API they get all the values related to orders and shipping adress under extention attributes. onc e they get shipping address id from this they will run the rest api to get customer address as hey are unable to get the door number value as this is a custom column in sales order address table. But they don't want to run the address api. they want door number in the order api itself. could you please suggest me a workaround. – user12992122 Jun 12 '20 at 06:03