0

I am trying to get discount amount, but no success

How to get discount amount from $block->getShipment()

<?php
 /** @var $_item \Magento\Sales\Model\Order\Item */

 $_item = $block->getItem();

 $_item->getDiscountAmount() // this gives me nothing , null

 ?>

How to get the discount amount. and there is a discount on that order.

  • You have check with echo $_item->getDiscountAmount() ?? Get 0 or null ?? – Limbani Himanshu Jul 31 at 11:24
  • it gives me null – summu Jul 31 at 11:25
  • you can check $_item->getName() ? it's found item name ?? – Limbani Himanshu Jul 31 at 11:36
  • Yes $_item->getQty() $_item->getPrice() , $_item->getName() all works except $_item-> getDiscountAmount() – summu Jul 31 at 11:37
  • you need to find item wise discount right ??? – Limbani Himanshu Jul 31 at 11:42
0

If discount is applited through shopping cart rule, then you can get discount amount by this:

$_item->getDiscountAmount();

But if you have applied discount amount using catalog rule or special price then you need to calculate discount manually by this:

$discount = $_item->getOriginalPrice() - $_item->getPrice();

Hope this will help

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.