Magento 2 How to get order details from Order Id script

To get the order details from magento 2 we will require the order id , first we will place the order as a customer in the installation we have , then we will login in to the admin panel or dashboard and navigate to Sales > Orders and click on the order details once we  have clicked on it we will see the order id in the url , note down the order id and replace the order id by the code you have


$orderId = "1";
$orderDetailsArray = $objectManager->create('Magento\Sales\Model\Order')->load($orderId);
print_r($orderDataArray->getData());


by printing this you will get the output as below as i am using command prompt for execution you can see the result here




No comments:

Post a Comment