Magento – “Stop Further Rules Processing” not applying to all items

cartdiscountshopping-cart-price-rules

There appears to be a bug with "Stop Further Rules Processing" in Magento CE1.9 / EE1.13 where only the first item in your cart recieves the discount.

I would expect:
If I have multiple shopping cart rules, each of which having "Stop Further Rules Processing: Yes", only the first of these rules would be applied, however it would be applied in full to all matching items for that rule.

What is happening:
The discount is only being applied to the first item in the cart, after which the rule processing is stopped.

See screenshots:
The discount I am expecting for the entire cart is $50, but due to "Stop Further Rules Processing" I am only seeing $25.

Magento Admin Panel

Magento Frontend Checkout

Best Answer

I think this could be because the _calculator is effectively stored as a singleton within the Mage_SalesRule_Model_Quote_Discount class, meaning that the second item to be processed will hit $this->_stopFurtherRules == true and bail.

My thought process is to store the ID of the $rule which is OK to be processed, allowing further items to process only this rule.

As per CE1.9.0.1 and EE1.14.0.1

Mage_SalesRule_Model_Validator line 316

- if ($this->_stopFurtherRules) {
+ if ($this->_stopFurtherRules !== false && $rule->getId() != $this->_stopFurtherRules) {

Mage_SalesRule_Model_Validator line 514

- $this->_stopFurtherRules = true;
+ $this->_stopFurtherRules = $rule->getId();

This is my proposed solution, I would be interested to hear reasons why this is a terrible idea!