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/

Vishwas Bhatnagar
4,7193 gold badges39 silver badges61 bronze badges
asked Nov 6, 2020 at 19:08

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/

answered Nov 7, 2020 at 6:24
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. Commented Nov 7, 2020 at 6:39
  • Share in question , the code you have tried Commented Nov 8, 2020 at 8:19

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.