0
$orderId = $order->getId();
                     $objectManager = $this->dataHelper->getObjectManager();
                     $order12 = $objectManager->create('\Magento\Sales\Model\OrderRepository')->get($orderId);

This code is not working in the observer. I am sending data through rest API. Getting issue in the console:

Failed to load resource: the server responded with a status of 500 (Internal Server Error)

Can you please provide the solution?

Thanks

3

1 Answer 1

0

Try

$order12 = $objectManager->create('Magento\Sales\Api\OrderRepositoryInterface')->get($orderId);

OR

$order12 = $objectManager->create('Magento\Sales\Model\Order')->load($orderId);
2
  • I have also tried with this Magento\Sales\Model\Order. Not getting result
    – Shomita
    Jan 18, 2020 at 13:32
  • Then try 1st solution with Magento\Sales\Api\OrderRepositoryInterface
    – Nayem323
    Jan 18, 2020 at 13:42

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.