{"data":{"id":"magento2-35730","source":"github-pr","sourceRef":"magento/magento2#35730","title":"Rounding problem on prices when adding tax to display prices","pr":{"number":35730,"url":"https://github.com/magento/magento2/pull/35730","author":"ravi-chandra3197","mergedAt":"2026-01-09T08:51:51Z","mergeCommit":"f9fa5f24bf426f845f4827108e9250507040ee81","headCommit":"a689c797e8260b18d61b3d17a23e24f5e7ff17de","baseRef":"2.4-develop","diffSha256":"2d3b73a9638d4e6daa0872cc8b2d1794be21a8155642770e8f66bccfa8ab63df"},"issues":[{"number":18025,"url":"https://github.com/magento/magento2/issues/18025","title":"Rounding problem on prices when adding tax to display prices","labels":["Area: Catalog","Component: Tax","Issue: Confirmed","Priority: P3","Progress: PR in progress","Progress: done","Reported on 2.4.x","Reproduced on 2.4.x","Severity: S4"],"kind":"human"}],"fixedIn":"2.4.9","containingTags":["2.4.9"],"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":"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-tax"],"files":[{"path":"app/code/Magento/Tax/Model/Calculation/AbstractCalculator.php","change":"modified","package":"magento/module-tax"}],"stripped":{"tests":["app/code/Magento/Tax/Test/Unit/Model/Calculation/UnitBaseCalculatorTest.php","dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ListProduct/CheckProductPriceTest.php"],"docs":[],"outsideCode":[]},"linesChanged":38,"mergeBatched":false,"excluded":null,"sections":{"description":"1. Magento\\Framework\\Pricing\\Price\\AbstractPrice returns value of 8.750001. This is visible example data-price-amount se to price wrapper element. See screenshot.\n![image](https://user-images.githubusercontent.com/5977769/45406745-80522d00-b678-11e8-842b-123a9c1e1484.png)","stepsToReproduce":"1.  Set _Configuration > Tax > Calculation Settings_ to following:\n![tax_calculation_settings](https://user-images.githubusercontent.com/5977769/45406384-682dde00-b677-11e8-85ec-e1400d2bc6ec.png)\n2. Set  _Configuration > Tax > Price Display Settings_ to _Including Tax_","expectedResult":"1. Tax should be added to price set in product data when getting amount from classes extending Magento\\Framework\\Pricing\\Price\\AbstractPrice. Example Affirm Water Bottle with price of 7.00 with tax of 25 percent should result final value of 8.75","actualResult":"1. Magento\\Framework\\Pricing\\Price\\AbstractPrice returns value of 8.750001. This is visible example data-price-amount se to price wrapper element. See screenshot.\n![image](https://user-images.githubusercontent.com/5977769/45406745-80522d00-b678-11e8-842b-123a9c1e1484.png)\n\n\n### Own findings\n\nProblem seems to stem from Magento\\Tax\\Model\\Calculation\\AbstractCalculator. Calculator is adding delta of 0.000001 in deltaRound to prices, even if the $round is set to false and no rounding is happening. \n\n```php\n    /**\n     * Round price based on previous rounding operation delta\n     *\n     * @param float $price\n     * @param string $rate\n     * @param bool $direction\n     * @param string $type\n     * @param bool $round\n     * @return float\n     */\n    protected function deltaRound($price, $rate, $direction, $type = self::KEY_REGULAR_DELTA_ROUNDING, $round = true)\n    {\n        if ($price) {\n            $rate = (string)$rate;\n            $type = $type . $direction;\n            // initialize the delta to a small number to avoid non-deterministic behavior with rounding of 0.5\n            $delta = isset($this->roundingDeltas[$type][$rate]) ?\n                $this->roundingDeltas[$type][$rate] :\n                0.000001;\n            $price += $delta;\n            $roundPrice = $price;\n            if ($round) {\n                $roundPrice = $this->calculationTool->round($roundPrice);\n            }\n            $this->roundingDeltas[$type][$rate] = $price - $roundPrice;\n            $price = $roundPrice;\n        }\n        return $price;\n    }\n```","source":"issue"},"signatures":[],"labels":{"area":["Catalog"],"component":["Tax"],"priority":"P3","severity":"S4","reportedOn":["2.4.x"]},"categories":["Price/Tax"],"triage":{"model":"@cf/cloudflare/clef","requestHash":"5dc3211c5717b5f95d225dbb99f4feb17e396fceadfcf3b04509b9e8c64b03f8","isBugfix":0.9756,"changeKind":{"choice":"bugfix","probabilities":{"bugfix":0.9663,"feature":0.0033,"refactor":0.0183,"tests_only":0.0071,"docs_only":0.0023,"dependency":0.0027},"confidence":0.9209},"scope":{"score":0.8572,"probabilities":{"0":0.2987,"1":0.5454,"2":0.1559},"confidence":0.1165},"risk":{"score":1.3207,"probabilities":{"0":0.2295,"1":0.2203,"2":0.5502},"confidence":0.1059},"area":{"choice":"catalog","probabilities":{"catalog":0.5347,"checkout":0.1341,"customer":0.013,"admin":0.0466,"graphql_api":0.0114,"framework":0.0786,"frontend":0.0589,"other":0.1227},"confidence":0.2354},"securityRelevant":0.0064,"reportedVersion":{"choice":"unspecified","probabilities":{"2.4.0":0.0131,"2.4.0-p1":0.0108,"2.4.1":0.0096,"2.4.1-p1":0.0094,"2.4.2":0.012,"2.4.2-p1":0.0078,"2.4.2-p2":0.0151,"2.4.3":0.0128,"2.4.3-p1":0.0116,"2.4.3-p2":0.013,"2.4.3-p3":0.0094,"2.4.4":0.0106,"2.4.4-p1":0.0095,"2.4.4-p10":0.0056,"2.4.4-p11":0.0079,"2.4.4-p12":0.0073,"2.4.4-p13":0.0071,"2.4.4-p14":0.009,"2.4.4-p15":0.007,"2.4.4-p16":0.0072,"2.4.4-p17":0.0068,"2.4.4-p18":0.0058,"2.4.4-p2":0.0044,"2.4.4-p3":0.0047,"2.4.4-p4":0.005,"2.4.4-p5":0.0068,"2.4.4-p6":0.0048,"2.4.4-p7":0.0046,"2.4.4-p8":0.0049,"2.4.4-p9":0.0038,"2.4.5":0.0057,"2.4.5-p1":0.0065,"2.4.5-p10":0.0045,"2.4.5-p11":0.0068,"2.4.5-p12":0.0058,"2.4.5-p13":0.0081,"2.4.5-p14":0.0063,"2.4.5-p15":0.0051,"2.4.5-p16":0.0043,"2.4.5-p17":0.006,"2.4.5-p2":0.0036,"2.4.5-p3":0.0052,"2.4.5-p4":0.0062,"2.4.5-p5":0.0048,"2.4.5-p6":0.0047,"2.4.5-p7":0.0049,"2.4.5-p8":0.0046,"2.4.5-p9":0.0034,"2.4.6":0.0076,"2.4.6-p1":0.0101,"2.4.6-p10":0.0069,"2.4.6-p11":0.0087,"2.4.6-p12":0.0081,"2.4.6-p13":0.0079,"2.4.6-p14":0.0085,"2.4.6-p15":0.0064,"2.4.6-p2":0.0045,"2.4.6-p3":0.0069,"2.4.6-p4":0.0077,"2.4.6-p5":0.0071,"2.4.6-p6":0.0073,"2.4.6-p7":0.0074,"2.4.6-p8":0.0051,"2.4.6-p9":0.0038,"2.4.7":0.0053,"2.4.7-p1":0.0053,"2.4.7-p10":0.0054,"2.4.7-p2":0.0046,"2.4.7-p3":0.007,"2.4.7-p4":0.0109,"2.4.7-p5":0.0078,"2.4.7-p6":0.0094,"2.4.7-p7":0.0076,"2.4.7-p8":0.0072,"2.4.7-p9":0.0044,"2.4.8":0.0061,"2.4.8-p1":0.0087,"2.4.8-p2":0.0131,"2.4.8-p3":0.0124,"2.4.8-p4":0.013,"2.4.8-p5":0.0097,"2.4.9":0.0118,"unspecified":0.3924},"confidence":0.1488},"backportWorthy":{"score":1.2863,"probabilities":{"0":0.1835,"1":0.3466,"2":0.4699},"confidence":0.0619}},"curated":{"title":"Fixes product prices returning a tiny rounding excess when tax is applied","description":"Rounding problem on prices when adding tax to display prices: AbstractPrice returns value of 8.750001 for a price of 7.00 with tax of 25 percent, expected 8.75. The calculator adds a delta of 0.000001 in deltaRound even if round is set to false. In the fix the delta is used only when rounding is set.","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:25:30.458Z","releaseCommit":"870a22c63d9d9b68fa3297962e2d5d5841115814","suites":{"unit":{"before":"fail","after":"pass","runAt":"2026-10-06T09:25:30.458Z"},"integration":{"before":"fail","after":"pass","runAt":"2026-10-06T09:25:30.458Z"}}},"2.4.7-p10":{"before":"fail","after":"pass","adapted":false,"runAt":"2026-10-06T09:40:43.704Z","releaseCommit":"72561bf80652f57cc642a03e2c9a51d74a285b14","suites":{"unit":{"before":"fail","after":"pass","runAt":"2026-10-06T09:40:43.704Z"},"integration":{"before":"fail","after":"pass","runAt":"2026-10-06T09:40:43.704Z"}}}}},"_documentation":"https://magento.watch/api","_description":"Upstream fix magento2-35730 details"}