{"data":{"id":"magento2-40869","source":"github-pr","sourceRef":"magento/magento2#40869","title":"Discard subsequent rules for shipping amount","pr":{"number":40869,"url":"https://github.com/magento/magento2/pull/40869","author":"aasim110","mergedAt":"2026-07-28T12:06:30Z","mergeCommit":"fc4094fdfff7ea9d1c8fbf10e9dbd4f95bd2a063","headCommit":"1e8308b501f35db687c03a0508317ade6efdb329","baseRef":"2.4-develop","diffSha256":"0209dabd0061d95cad21d55d5946a153f48e8d1ec3eccbe69c695972b802a03c"},"issues":[{"number":37985,"url":"https://github.com/magento/magento2/issues/37985","title":"Discard subsequent rules for shipping amount","labels":["Area: Cart & Checkout","Component: Checkout","Issue: Confirmed","Priority: P2","Progress: PR Created","Progress: done","Reported on 2.4.x","Reproduced on 2.4.x"],"kind":"human"}],"fixedIn":null,"containingTags":[],"reportedOn":null,"codeMatch":{"2.4.6":"clean","2.4.6-p1":"clean","2.4.6-p2":"clean","2.4.6-p3":"clean","2.4.6-p4":"clean","2.4.6-p5":"clean","2.4.6-p6":"clean","2.4.6-p7":"clean","2.4.6-p8":"clean","2.4.6-p9":"clean","2.4.6-p10":"clean","2.4.6-p11":"clean","2.4.6-p12":"clean","2.4.6-p13":"clean","2.4.6-p14":"clean","2.4.6-p15":"clean","2.4.7":"clean","2.4.7-p1":"clean","2.4.7-p2":"clean","2.4.7-p3":"clean","2.4.7-p4":"clean","2.4.7-p5":"clean","2.4.7-p6":"clean","2.4.7-p7":"clean","2.4.7-p8":"clean","2.4.7-p9":"clean","2.4.7-p10":"clean","2.4.8":"clean","2.4.8-p1":"clean","2.4.8-p2":"clean","2.4.8-p3":"clean","2.4.8-p4":"clean","2.4.8-p5":"clean","2.4.9":"clean"},"affectedVersions":["2.4.6","2.4.6-p1","2.4.6-p2","2.4.6-p3","2.4.6-p4","2.4.6-p5","2.4.6-p6","2.4.6-p7","2.4.6-p8","2.4.6-p9","2.4.6-p10","2.4.6-p11","2.4.6-p12","2.4.6-p13","2.4.6-p14","2.4.6-p15","2.4.7","2.4.7-p1","2.4.7-p2","2.4.7-p3","2.4.7-p4","2.4.7-p5","2.4.7-p6","2.4.7-p7","2.4.7-p8","2.4.7-p9","2.4.7-p10","2.4.8","2.4.8-p1","2.4.8-p2","2.4.8-p3","2.4.8-p4","2.4.8-p5","2.4.9"],"components":["magento/module-sales-rule"],"files":[{"path":"app/code/Magento/SalesRule/Model/Validator.php","change":"modified","package":"magento/module-sales-rule"}],"stripped":{"tests":["app/code/Magento/SalesRule/Test/Unit/Model/ValidatorTest.php"],"docs":[],"outsideCode":[]},"linesChanged":13,"mergeBatched":false,"excluded":null,"sections":{"description":"Discount in step 4 is incorrect: $70","stepsToReproduce":"1. Create the first cart price rule:\nRule Information:\nActive: Yes\nCoupon: Specific Coupon\nCoupon Code: 50OFF\n**Priority: 0**\nCondition: None\nActions\nApply: Percent of product price discount\nDiscount Amount: 50%\nMaximum Qty Discount is Applied To: 0\nDiscount Qty Step (Buy X): 0\n**Apply to Shipping Amount: No**\nDiscard subsequent rules: Yes\n\n2. Create the second cart price rule\nRule Information:\nActive: Yes\nCoupon: No Coupon\n**Priority: 1**\nCondition:\n**If trial SKU is in cart**\nActions\nApply: Percent of product price discount\nDiscount Amount: 100%\nMaximum Qty Discount is Applied To: 1\nDiscount Qty Step (Buy X): 0\n**Apply to Shipping Amount: Yes**\nDiscard subsequent rules: Yes\n\n3. Add to cart 2 products: first product = trial SKU, second product = non-trial SKU. \nThe second rule applies\nTrial SKU price: $20\nNon-trial SKU price: $100\nShipping: $10\nSubtotal: $130\nDiscount: -$30.00\n\n4. Apply Discount Code: 50OFF\n_**The first rule is applied correctly but the second rule's shipping discount is applied incorrectly**_\nTrial SKU price: $20\nNon-trial SKU price: $100\nShipping: $10\nSubtotal: $130\nDiscount: -$70","expectedResult":"Discount in step 4 should be $60","actualResult":"Discount in step 4 is incorrect: $70","source":"issue"},"signatures":[],"labels":{"area":["Cart & Checkout"],"component":["Checkout"],"priority":"P2","severity":null,"reportedOn":["2.4.x"]},"categories":["Order/Checkout","Shopping Cart"],"triage":{"model":"@cf/cloudflare/clef","requestHash":"89c460a0e8c5b8c016c8869baa712346ff2315aabee82bfd0bec3814712d1718","isBugfix":0.9862,"changeKind":{"choice":"bugfix","probabilities":{"bugfix":0.9774,"feature":0.004,"refactor":0.0086,"tests_only":0.0052,"docs_only":0.0023,"dependency":0.0025},"confidence":0.9466},"scope":{"score":0.6122,"probabilities":{"0":0.513,"1":0.3617,"2":0.1253},"confidence":0.1146},"risk":{"score":1.2941,"probabilities":{"0":0.2442,"1":0.2175,"2":0.5383},"confidence":0.095},"area":{"choice":"checkout","probabilities":{"catalog":0.0054,"checkout":0.9479,"customer":0.0042,"admin":0.0121,"graphql_api":0.0032,"framework":0.01,"frontend":0.0049,"other":0.0123},"confidence":0.8845},"securityRelevant":0.0053,"reportedVersion":{"choice":"unspecified","probabilities":{"2.4.0":0.0108,"2.4.0-p1":0.005,"2.4.1":0.0039,"2.4.1-p1":0.0032,"2.4.2":0.005,"2.4.2-p1":0.0038,"2.4.2-p2":0.0062,"2.4.3":0.0112,"2.4.3-p1":0.0089,"2.4.3-p2":0.0113,"2.4.3-p3":0.0062,"2.4.4":0.0121,"2.4.4-p1":0.0083,"2.4.4-p10":0.0052,"2.4.4-p11":0.0066,"2.4.4-p12":0.0054,"2.4.4-p13":0.005,"2.4.4-p14":0.0068,"2.4.4-p15":0.0046,"2.4.4-p16":0.0058,"2.4.4-p17":0.0043,"2.4.4-p18":0.0041,"2.4.4-p2":0.0031,"2.4.4-p3":0.0032,"2.4.4-p4":0.0038,"2.4.4-p5":0.0036,"2.4.4-p6":0.0041,"2.4.4-p7":0.004,"2.4.4-p8":0.0034,"2.4.4-p9":0.0037,"2.4.5":0.0107,"2.4.5-p1":0.007,"2.4.5-p10":0.0051,"2.4.5-p11":0.0076,"2.4.5-p12":0.0067,"2.4.5-p13":0.0054,"2.4.5-p14":0.008,"2.4.5-p15":0.0043,"2.4.5-p16":0.005,"2.4.5-p17":0.0056,"2.4.5-p2":0.0033,"2.4.5-p3":0.0046,"2.4.5-p4":0.0058,"2.4.5-p5":0.0043,"2.4.5-p6":0.0053,"2.4.5-p7":0.005,"2.4.5-p8":0.0044,"2.4.5-p9":0.0032,"2.4.6":0.0148,"2.4.6-p1":0.0132,"2.4.6-p10":0.0071,"2.4.6-p11":0.0098,"2.4.6-p12":0.0094,"2.4.6-p13":0.0075,"2.4.6-p14":0.0073,"2.4.6-p15":0.0061,"2.4.6-p2":0.0041,"2.4.6-p3":0.0056,"2.4.6-p4":0.0069,"2.4.6-p5":0.0053,"2.4.6-p6":0.0057,"2.4.6-p7":0.0062,"2.4.6-p8":0.0049,"2.4.6-p9":0.0039,"2.4.7":0.0114,"2.4.7-p1":0.0092,"2.4.7-p10":0.0069,"2.4.7-p2":0.0062,"2.4.7-p3":0.0091,"2.4.7-p4":0.0116,"2.4.7-p5":0.0084,"2.4.7-p6":0.0093,"2.4.7-p7":0.0076,"2.4.7-p8":0.0061,"2.4.7-p9":0.0049,"2.4.8":0.0178,"2.4.8-p1":0.0117,"2.4.8-p2":0.0141,"2.4.8-p3":0.0136,"2.4.8-p4":0.0128,"2.4.8-p5":0.0099,"2.4.9":0.0149,"unspecified":0.4228},"confidence":0.1737},"backportWorthy":{"score":1.5016,"probabilities":{"0":0.0852,"1":0.3281,"2":0.5867},"confidence":0.1887}},"curated":{"title":"Fixes a later rule applying shipping discount after Discard subsequent rules","description":"A cart price rule with Apply to Shipping Amount set to No and Discard subsequent rules set to Yes did not stop the shipping amount processing, so the second rule applied its shipping discount ($70 discount, $60 expected). In Validator::processShippingAmount(), such a rule now ends the loop with a break when its id is in the address applied rule ids, instead of a continue.","categories":["Order/Checkout","Shopping Cart"],"author":"claude-code/opus-5.5","date":"2026-10-06","reviewedBy":null},"tests":{"2.4.8-p5":{"before":"fail","after":"pass","adapted":true,"runAt":"2026-10-06T09:20:30.375Z","releaseCommit":"870a22c63d9d9b68fa3297962e2d5d5841115814","suites":{"unit":{"before":"fail","after":"pass","runAt":"2026-10-06T09:20:30.375Z"}}},"2.4.9":{"before":"fail","after":"pass","adapted":false,"runAt":"2026-10-06T09:20:32.349Z","releaseCommit":"755e34dd689021c5165db9d35ecff74f7dc51527","suites":{"unit":{"before":"fail","after":"pass","runAt":"2026-10-06T09:20:32.349Z"}}},"2.4.7-p10":{"before":"not-runnable","after":"error","adapted":true,"runAt":"2026-10-06T09:29:33.706Z","releaseCommit":"72561bf80652f57cc642a03e2c9a51d74a285b14","suites":{"unit":{"before":"not-runnable","after":"error","runAt":"2026-10-06T09:29:33.706Z"}}}}},"_documentation":"https://magento.watch/api","_description":"Upstream fix magento2-40869 details"}