1

I'm looking into commerce module for drupal 8 and using its submodule commerce promotion. So i only want to get discounted price in current user cart. i got coupon code but that doesn't help to get discounted amount.

Please help.

Sourabh Bhutani
  • 623
  • 11
  • 21

1 Answers1

3

Here i want to share how i got discount problem fixed. Discounts are in adjustment per order_item in order object. So i got discounted amount by below:

$adjusment_order_item = $order_item->getAdjustments();
            if($adjusment_order_item){
              $adjustment_data = $adjusment_order_item[0]->getAmount();
              $adjustment = $adjustment + $adjustment_data->getNumber();
              $adjustment_currency = $adjustment_data->getCurrencyCode();
            }
Sourabh Bhutani
  • 623
  • 11
  • 21