{"data":{"id":"magento2-39687","source":"github-pr","sourceRef":"magento/magento2#39687","title":"Wrong Order total, the round is not applied to the price calculation.","pr":{"number":39687,"url":"https://github.com/magento/magento2/pull/39687","author":"YuriyYavorskiy","mergedAt":"2025-05-20T18:19:52Z","mergeCommit":"135b96fcaeef5c8b52e9380a6de2c3cbc0f5e4e0","headCommit":"e1d974e7f0f48e33903d6f3375a4e99f18b7b8c9","baseRef":"2.4-develop","diffSha256":"0fd7786de399038000171761d874c17fd3cd4b54d6963aab4b4785cb54b6e0c5"},"issues":[{"number":38455,"url":"https://github.com/magento/magento2/issues/38455","title":"Wrong Order total, the round is not applied to the price calculation.","labels":["Area: Tax","Component: Tax","Issue: Confirmed","Priority: P2","Progress: done","Reported on 2.4.6-p3","Reproduced on 2.4.x"],"kind":"human"}],"fixedIn":"2.4.9","containingTags":["2.4.9"],"reportedOn":"2.4.6-p3","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":"conflict"},"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"],"components":["magento/module-sales-rule"],"files":[{"path":"app/code/Magento/SalesRule/Model/Rule/Action/Discount/ByPercent.php","change":"modified","package":"magento/module-sales-rule"}],"stripped":{"tests":["app/code/Magento/SalesRule/Test/Unit/Model/Rule/Action/Discount/ToPercentTest.php","dev/tests/integration/testsuite/Magento/SalesRule/Model/Rule/Action/Discount/CartFixedTest.php"],"docs":[],"outsideCode":[]},"linesChanged":20,"mergeBatched":false,"excluded":null,"sections":{"description":"Magento not doing the round function when calculating price_after_discount, discount_amount and taxes amount for the second product added to the cart.\nresulting in total 3667,51 when reproducing the error using method 1 and 3667,5 when reproducing the error using method 2.","stepsToReproduce":"Two ways to reproduce the error:\nMethod 1:\n1- add product 1 * 3 to the cart\n2- add product 2 * 2 to the cart\n3- go to the checkout \n4- apply the discount and use the country for the tax to be applied\n5- create order\n\nMethod 2:\n1- add product 2 * 2 to the cart\n2- add product 1 * 3 to the cart\n3- go to the checkout \n4- apply the discount and use the country for the tax to be applied\n5- create order","expectedResult":"The function round should be applied when calculating the price_after_discount, discount_amount and taxes amount.\nthe actual total of the order should be 3667,52.","actualResult":"Magento not doing the round function when calculating price_after_discount, discount_amount and taxes amount for the second product added to the cart.\nresulting in total 3667,51 when reproducing the error using method 1 and 3667,5 when reproducing the error using method 2.\n\n![hat-jacket](https://github.com/magento/magento2/assets/66772877/b0762be3-9fe3-4a96-927f-597d6681605d)\n\n![jacket-hat](https://github.com/magento/magento2/assets/66772877/b00e9b09-c324-44ce-8040-b22fc115bc89)","source":"issue"},"signatures":[],"labels":{"area":["Tax"],"component":["Tax"],"priority":"P2","severity":null,"reportedOn":["2.4.6-p3"]},"categories":["Price/Tax"],"triage":{"model":"@cf/cloudflare/clef","requestHash":"6087b39a655a0cdf5ea565edb0c54de9b5698af16f7459a192f3457b8185f0d1","isBugfix":0.9746,"changeKind":{"choice":"bugfix","probabilities":{"bugfix":0.9672,"feature":0.0043,"refactor":0.0115,"tests_only":0.0096,"docs_only":0.0034,"dependency":0.004},"confidence":0.9228},"scope":{"score":0.8159,"probabilities":{"0":0.2979,"1":0.5883,"2":0.1138},"confidence":0.1717},"risk":{"score":1.5041,"probabilities":{"0":0.1828,"1":0.1303,"2":0.6869},"confidence":0.2833},"area":{"choice":"checkout","probabilities":{"catalog":0.0147,"checkout":0.881,"customer":0.0082,"admin":0.0184,"graphql_api":0.0062,"framework":0.0155,"frontend":0.0101,"other":0.0459},"confidence":0.7477},"securityRelevant":0.0074,"reportedVersion":{"choice":"2.4.6-p3","probabilities":{"2.4.0":0.0021,"2.4.0-p1":0.0025,"2.4.1":0.0023,"2.4.1-p1":0.0026,"2.4.2":0.0026,"2.4.2-p1":0.0028,"2.4.2-p2":0.0031,"2.4.3":0.0029,"2.4.3-p1":0.003,"2.4.3-p2":0.0036,"2.4.3-p3":0.0035,"2.4.4":0.0024,"2.4.4-p1":0.0029,"2.4.4-p10":0.0033,"2.4.4-p11":0.0039,"2.4.4-p12":0.004,"2.4.4-p13":0.0039,"2.4.4-p14":0.0036,"2.4.4-p15":0.0034,"2.4.4-p16":0.0035,"2.4.4-p17":0.0033,"2.4.4-p18":0.0029,"2.4.4-p2":0.0025,"2.4.4-p3":0.0025,"2.4.4-p4":0.0024,"2.4.4-p5":0.0028,"2.4.4-p6":0.0033,"2.4.4-p7":0.0028,"2.4.4-p8":0.003,"2.4.4-p9":0.003,"2.4.5":0.0035,"2.4.5-p1":0.0033,"2.4.5-p10":0.0034,"2.4.5-p11":0.0046,"2.4.5-p12":0.0054,"2.4.5-p13":0.0043,"2.4.5-p14":0.0045,"2.4.5-p15":0.0038,"2.4.5-p16":0.0045,"2.4.5-p17":0.0039,"2.4.5-p2":0.0036,"2.4.5-p3":0.0044,"2.4.5-p4":0.0034,"2.4.5-p5":0.0037,"2.4.5-p6":0.0044,"2.4.5-p7":0.0038,"2.4.5-p8":0.0036,"2.4.5-p9":0.003,"2.4.6":0.0228,"2.4.6-p1":0.006,"2.4.6-p10":0.0035,"2.4.6-p11":0.0038,"2.4.6-p12":0.0036,"2.4.6-p13":0.0077,"2.4.6-p14":0.0033,"2.4.6-p15":0.0032,"2.4.6-p2":0.0078,"2.4.6-p3":0.6581,"2.4.6-p4":0.0109,"2.4.6-p5":0.0088,"2.4.6-p6":0.0084,"2.4.6-p7":0.0069,"2.4.6-p8":0.0047,"2.4.6-p9":0.0036,"2.4.7":0.0041,"2.4.7-p1":0.0039,"2.4.7-p10":0.0036,"2.4.7-p2":0.0036,"2.4.7-p3":0.0049,"2.4.7-p4":0.0047,"2.4.7-p5":0.0049,"2.4.7-p6":0.0052,"2.4.7-p7":0.0036,"2.4.7-p8":0.0032,"2.4.7-p9":0.0028,"2.4.8":0.003,"2.4.8-p1":0.0038,"2.4.8-p2":0.0044,"2.4.8-p3":0.0043,"2.4.8-p4":0.0044,"2.4.8-p5":0.0043,"2.4.9":0.004,"unspecified":0.0027},"confidence":0.4282},"backportWorthy":{"score":1.5586,"probabilities":{"0":0.0807,"1":0.28,"2":0.6393},"confidence":0.2404}},"curated":{"title":"Wrong order total as the round function is not applied to the discount","description":"With a discount and tax, the round function is not applied to the discount amount, so the order total is 3667,51 or 3667,5 and not 3667,52, by which product is added to the cart first. In ByPercent, round to 2 is now applied to each discount amount, base amount and original amount.","categories":["Price/Tax"],"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:29:43.030Z","releaseCommit":"870a22c63d9d9b68fa3297962e2d5d5841115814","suites":{"unit":{"before":"fail","after":"pass","runAt":"2026-10-06T09:29:43.030Z"},"integration":{"before":"fail","after":"pass","runAt":"2026-10-06T09:29:43.030Z"}}},"2.4.7-p10":{"before":"fail","after":"pass","adapted":false,"runAt":"2026-10-06T09:57:46.961Z","releaseCommit":"72561bf80652f57cc642a03e2c9a51d74a285b14","suites":{"unit":{"before":"fail","after":"pass","runAt":"2026-10-06T09:57:46.961Z"},"integration":{"before":"fail","after":"pass","runAt":"2026-10-06T09:57:46.961Z"}}}}},"_documentation":"https://magento.watch/api","_description":"Upstream fix magento2-39687 details"}