The default Magento allows the admin to add shopping cart price rules.
He can offer coupon codes to avail the discounts.
However, sometimes you may want to set conditions based on which discounts are offered.
For example, the admin wants to offer a specific payment method only for certain scenarios.
To implement this, the admin needs to check which shopping cart rule is applied to cart in Magento.
The below solution can be used for the same:
Method to Check Which Shopping Cart Rule is Applied to Cart in Magento:
Add the below code.
$appliedRuleIds = Mage::getSingleton('checkout/session')->getQuote()->getAppliedRuleIds(); $appliedRuleIds = explode(',', $appliedRuleIds); print_r($appliedRuleIds);
By adding this code, you will be able to check which shopping cart price rule has applied to quote.
That’s it.
Thank you.