How can I get product price by sales_order_item table?

1 Answer 1


Inject the order Model in your constructor

protected $orderModel;

public function __construct(
    \Magento\Sales\Model\Order $orderModel,
) {
    $this->orderModel = $orderModel;

Then use this method as:

$order = $this->orderModel->load($orderId); //Add your order ID
foreach ($order->getAllItems() as $item) {
    echo $item->getPrice()."<br>";

This worked for me. Hope it also works for you.


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.