1

I want to get all applied discount in my cart (include auto discount and manual coupon) is that possible? Previously I was using Magento\SalesRule\Model\Coupon but it only get coupon with coupon code and unable to get automatic apply discount (who didn't have coupon code). Thank you in advance.

enter image description here

2

Each quote has the applied_rule_ids property which determine any cart rule was applied. You can use:

$ruleIds = $quote->getAppliedRuleIds();

and then you can get this rules from the Magento\SalesRule\Api\RuleRepositoryInterface.

Applied rule ids in DB

1
  • Thanks it works as expected.
    – Wavesolid
    Nov 4 '21 at 7:43

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.