How to configure the maximum discount percent in magento for the cart amount.

Example: Cart value is 3,50,000

Coupon Code discount applicable : 20%

Discount applicable 70,000

However I want to limit this to 50,000 only.


Surprisingly, this is not possible in the Magento 1.x without an extension or code modification.

To add this feature in our module we had to:

1) add a new field max_discount in the table salesrule

2) observe event salesrule_validator_process


3) keep track of all discounts given to item by rule_id (just remember them in a variable)

protected function _limitMaxDiscount($r, $rule, $itemId, $quote)
    if ($rule->getMaxDiscount()==0) {
        return $r[$itemId];
    if (isset($this->_ruleDiscount[$rule->getId()])) {
        $this->_ruleDiscount[$rule->getId()]['base_discount'] += $r[$itemId]['base_discount'];
    } else {
        $this->_ruleDiscount[$rule->getId()]['base_discount'] = $r[$itemId]['base_discount'];
    if ($this->_ruleDiscount[$rule->getId()]['base_discount'] > $rule->getMaxDiscount()) {
        $r[$itemId]['base_discount'] = $r[$itemId]['base_discount'] - ($this->_ruleDiscount[$rule->getId()]['base_discount'] - $rule->getMaxDiscount());
        $r[$itemId]['discount'] = $quote->getStore()->convertPrice(
    return $r[$itemId];

4) when apply next discount to an item, check if it is in the range.

| improve this answer | |
  • 3
    Where is the "handleValidation" function definition? please reply. – Vinaya Maheshwari Jan 16 '18 at 11:14

Login to Admin panel > Promotions > Shopping cart price rules > than create new rules with below condition :

Steps : General information enter image description here

step 2 : conditions enter image description here

step 3 : Actions enter image description here

Apply "your coupon code" as coupon code in shopping cart page. also enter the discount amount under "Actions"

Please remove cache.

| improve this answer | |

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.