Hi @sumeetmangbeec and @x_xx ,
Can you please check below link for extension_attribute code and compare your code with this to solve above error
https://www.tigren.com/add-extension-attribute-magento-2/
Hope this helps you!
Problem Solved! Click Kudos & Accept as Solution!
Yes i checked but here some things which I don't know why they mention here, you can see
Step - 5
$this->tigrenExampleRepository
Step - 6
$this->tigrenExampleRepository
$this->tigrenAttributeFactory->create()
what is the use of this ?
I just add a custom column in sales_order table,need to just update this column when REST API call
I also this question magento StackExchange - https://magento.stackexchange.com/questions/317687/magento-2-how-to-update-custom-order-attribute-us...
but still no luck
Hi @sumeetmangbeec ,
I have checked your code on Magento stack exchange. Can you please replace below code in your plugin class OrderRepository.php
public function beforeSave(OrderRepositoryInterface $subject, OrderInterface $order ) { $extensionAttributes = $order->getExtensionAttributes() ?: $this->extensionFactory->create(); if ($extensionAttributes !== null && $extensionAttributes->getCustomSalesId() !== null) { $order->setCustomSalesId($extensionAttributes->getCustomSalesId()); } return [$order]; }
Please check the below code and try to create/save an order.
Hope this works for you!
Problem Solved! Click Kudos & Accept as Solution!