1

I load an order model like this:

$order = $this->orderFactory->create()->load($orderId);

and to get the order total i use :

$order->getGrandTotal();

this order total will show the total order with discount included, how can i get the order total without discount from coupon code and any special price included?

  • Is it working? @blue – Rohan Hapani Oct 17 '18 at 11:09
  • use $order->getSubtotal(); instead of grand total. – Sameer Bhayani Oct 17 '18 at 11:10
0

Try to use this below code :

$order = $this->orderFactory->create()->load($orderId);
$orderItems = $order->getAllItems();
$itemQty = array();
foreach ($orderItems as $item) {
     $itemQty['price'] = $item->getPrice();
}
return $itemQty;
  • are there no other simple way? – blue Oct 17 '18 at 13:09
  • Is it not working? It's proper magento standard way. – Rohan Hapani Oct 17 '18 at 13:10
  • Please accept and upvote answer if it's working. So, this will be useful for other developers. – Rohan Hapani Oct 17 '18 at 13:16
  • Happy to help !! Happy coding :) – Rohan Hapani Oct 17 '18 at 13:17

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.