0

I have successfully placed order by creating cart and finally calling rest api /rest//V1/guest-carts/{cart-id}/order to place the order. Now I am trying to add an additional attribute custom_attribute to be displayed on orders table page of admin dashboard but am unable to figure out the way around.

I have tried to extend the magento functionality using following link but somehow cannot set custom attribute via rest api

https://www.yereone.com/blog/magento-2-how-to-add-new-order-attribute/

1 Answer 1

0

You can do that with help of extension attributes , here is magento documentation how to add an extension attribute https://devdocs.magento.com/guides/v2.4/extension-dev-guide/extension_attributes/adding-attributes.html

There are also some stack questions that you can refer to

Add extension attribute to Order

and some good articles https://www.rakeshjesadiya.com/extension-attribute-in-order-data-magento-2/

2
  • I am unable to get this line working: $orderComment = $order->getData(self::FIELD_NAME); as given in the article I am calling the api : /rest//V1/guest-carts/{cart-id}/order and passing 'order_comment' in request but somehow unable to access it here. Nov 7, 2020 at 6:39
  • Share in question , the code you have tried Nov 8, 2020 at 8:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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