{"data":{"id":"magento2-39525","source":"github-pr","sourceRef":"magento/magento2#39525","title":"Cart price rule with condition SKU doesn't take into account the \"leading zeros\" in the SKU (sku: 01234 is the same as 1234)","pr":{"number":39525,"url":"https://github.com/magento/magento2/pull/39525","author":"magentoabu","mergedAt":"2025-04-16T11:05:48Z","mergeCommit":"6de90ff5d40c879df58b4aedfe186723e4559ca7","headCommit":"d52ec0102a1c397230e6a0bec0ca77fb800901c0","baseRef":"2.4-develop","diffSha256":"339caef7ec030d9bf34e03a71adfad79cfda7c151b11a2b70859ce95dec6afc8"},"issues":[{"number":37919,"url":"https://github.com/magento/magento2/issues/37919","title":"Cart price rule with condition SKU doesn't take into account the \"leading zeros\" in the SKU (sku: 01234 is the same as 1234)","labels":["Area: Admin UI","Issue: Confirmed","Priority: P3","Progress: PR in progress","Progress: done","Reported on 2.4.4","Reproduced on 2.4.x"],"kind":"human"}],"fixedIn":"2.4.9","containingTags":["2.4.9"],"reportedOn":"2.4.4","codeMatch":{"2.4.6":"conflict","2.4.6-p1":"conflict","2.4.6-p2":"conflict","2.4.6-p3":"conflict","2.4.6-p4":"conflict","2.4.6-p5":"conflict","2.4.6-p6":"conflict","2.4.6-p7":"conflict","2.4.6-p8":"conflict","2.4.6-p9":"conflict","2.4.6-p10":"conflict","2.4.6-p11":"conflict","2.4.6-p12":"conflict","2.4.6-p13":"conflict","2.4.6-p14":"conflict","2.4.6-p15":"conflict","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":"conflict"},"affectedVersions":["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"],"components":["magento/module-rule"],"files":[{"path":"app/code/Magento/Rule/Model/Condition/AbstractCondition.php","change":"modified","package":"magento/module-rule"}],"stripped":{"tests":["app/code/Magento/Rule/Test/Unit/Model/Condition/AbstractConditionTest.php"],"docs":[],"outsideCode":[]},"linesChanged":14,"mergeBatched":false,"excluded":null,"sections":{"description":"Discount for product with SKU:  1234  IS applied (even the SKU is not in the CART PRICE RULE CONDITION).","stepsToReproduce":"1. Create product with SKU: 1234\n2. Create product with SKU: 01234\n3. Create CART PRICE RULE (for example): \n- Specific coupon\n- Coupon code: TESTSKU\n- ACTION: percent of product price discount, 50% discount amount)\n- Apply the rule only to cart items ... (SKU   is    01234)\n\n5. Go to shop front and add product SKU 1234 to CART\n6. On the cart page enter the coupon code TESTSKU","expectedResult":"Discount for product with SKU: 1234 of 50% should NOT be applied.","actualResult":"Discount for product with SKU:  1234  IS applied (even the SKU is not in the CART PRICE RULE CONDITION).","source":"issue"},"signatures":[],"labels":{"area":["Admin UI"],"component":[],"priority":"P3","severity":null,"reportedOn":["2.4.4"]},"categories":[],"triage":{"model":"@cf/cloudflare/clef","requestHash":"0855a0c501a37699bfc8a4d1bb96d78ec67d01754691de1a3efbe3c782b137fc","isBugfix":0.9738,"changeKind":{"choice":"bugfix","probabilities":{"bugfix":0.9666,"feature":0.0054,"refactor":0.0124,"tests_only":0.0084,"docs_only":0.0033,"dependency":0.0039},"confidence":0.9214},"scope":{"score":0.5955,"probabilities":{"0":0.5168,"1":0.3708,"2":0.1124},"confidence":0.1259},"risk":{"score":1.009,"probabilities":{"0":0.3376,"1":0.3159,"2":0.3465},"confidence":0.0007},"area":{"choice":"checkout","probabilities":{"catalog":0.0625,"checkout":0.4817,"customer":0.0075,"admin":0.0947,"graphql_api":0.0055,"framework":0.2157,"frontend":0.0159,"other":0.1165},"confidence":0.2061},"securityRelevant":0.0132,"reportedVersion":{"choice":"2.4.4","probabilities":{"2.4.0":0.0023,"2.4.0-p1":0.0026,"2.4.1":0.0022,"2.4.1-p1":0.0024,"2.4.2":0.0041,"2.4.2-p1":0.003,"2.4.2-p2":0.0039,"2.4.3":0.007,"2.4.3-p1":0.0041,"2.4.3-p2":0.0056,"2.4.3-p3":0.0034,"2.4.4":0.5115,"2.4.4-p1":0.0168,"2.4.4-p10":0.0094,"2.4.4-p11":0.0148,"2.4.4-p12":0.0081,"2.4.4-p13":0.0069,"2.4.4-p14":0.0091,"2.4.4-p15":0.007,"2.4.4-p16":0.0091,"2.4.4-p17":0.0081,"2.4.4-p18":0.0073,"2.4.4-p2":0.0054,"2.4.4-p3":0.0071,"2.4.4-p4":0.0071,"2.4.4-p5":0.0075,"2.4.4-p6":0.0094,"2.4.4-p7":0.0072,"2.4.4-p8":0.006,"2.4.4-p9":0.0049,"2.4.5":0.0056,"2.4.5-p1":0.0053,"2.4.5-p10":0.0041,"2.4.5-p11":0.005,"2.4.5-p12":0.0059,"2.4.5-p13":0.0048,"2.4.5-p14":0.0053,"2.4.5-p15":0.0042,"2.4.5-p16":0.0044,"2.4.5-p17":0.0039,"2.4.5-p2":0.0033,"2.4.5-p3":0.0039,"2.4.5-p4":0.0042,"2.4.5-p5":0.0035,"2.4.5-p6":0.0043,"2.4.5-p7":0.0036,"2.4.5-p8":0.0039,"2.4.5-p9":0.0024,"2.4.6":0.0065,"2.4.6-p1":0.0067,"2.4.6-p10":0.0054,"2.4.6-p11":0.0061,"2.4.6-p12":0.0051,"2.4.6-p13":0.0051,"2.4.6-p14":0.0051,"2.4.6-p15":0.0039,"2.4.6-p2":0.0034,"2.4.6-p3":0.0047,"2.4.6-p4":0.0061,"2.4.6-p5":0.0051,"2.4.6-p6":0.0043,"2.4.6-p7":0.0043,"2.4.6-p8":0.0041,"2.4.6-p9":0.0028,"2.4.7":0.0037,"2.4.7-p1":0.0044,"2.4.7-p10":0.0043,"2.4.7-p2":0.0042,"2.4.7-p3":0.0052,"2.4.7-p4":0.0068,"2.4.7-p5":0.0061,"2.4.7-p6":0.0067,"2.4.7-p7":0.006,"2.4.7-p8":0.0059,"2.4.7-p9":0.0034,"2.4.8":0.0036,"2.4.8-p1":0.0042,"2.4.8-p2":0.0054,"2.4.8-p3":0.0058,"2.4.8-p4":0.0076,"2.4.8-p5":0.0058,"2.4.9":0.0054,"unspecified":0.0459},"confidence":0.2577},"backportWorthy":{"score":1.5026,"probabilities":{"0":0.0925,"1":0.3125,"2":0.595},"confidence":0.1904}},"curated":{"title":"Fixes cart price rule SKU condition not taking leading zeros into account","description":"A cart price rule with condition SKU doesn't take into account the leading zeros: with SKU 01234 in the rule, the discount is applied for the product with SKU 1234. In Magento\\Rule\\Model\\Condition\\AbstractCondition, _compareValues now uses === when a numeric value has a leading zero, and validateAttribute gets a new === case.","categories":[],"author":"claude-code/opus-5.5","date":"2026-10-06","reviewedBy":null},"tests":{"2.4.8-p5":{"before":"fail","after":"pass","adapted":false,"runAt":"2026-10-06T09:20:10.866Z","releaseCommit":"870a22c63d9d9b68fa3297962e2d5d5841115814","suites":{"unit":{"before":"fail","after":"pass","runAt":"2026-10-06T09:20:10.866Z"}}},"2.4.7-p10":{"before":"fail","after":"pass","adapted":false,"runAt":"2026-10-06T09:29:18.146Z","releaseCommit":"72561bf80652f57cc642a03e2c9a51d74a285b14","suites":{"unit":{"before":"fail","after":"pass","runAt":"2026-10-06T09:29:18.146Z"}}}}},"_documentation":"https://magento.watch/api","_description":"Upstream fix magento2-39525 details"}