Skip to content

Commit 77cd029

Browse files
ENGCOM-3464: Floating point overflows in checkout totals fixed #18185
- Merge Pull Request #18185 from jayankaghosh/magento2:issue-18027 - Merged commits: 1. 1ef3f14 2. 93a94c3 3. 55ba0ae 4. 888d02c 5. 935dfa8 6. 1f5b849 7. 7cd85c8
2 parents 733f2fc + 7cd85c8 commit 77cd029

File tree

1 file changed

+5
-0
lines changed
  • app/code/Magento/Quote/Model/Quote/Address

1 file changed

+5
-0
lines changed

app/code/Magento/Quote/Model/Quote/Address/Total.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
namespace Magento\Quote\Model\Quote\Address;
77

88
/**
9+
* Class Total
910
* @method string getCode()
1011
*
1112
* @api
@@ -54,6 +55,8 @@ public function __construct(
5455
*/
5556
public function setTotalAmount($code, $amount)
5657
{
58+
$amount = is_float($amount) ? round($amount, 4) : $amount;
59+
5760
$this->totalAmounts[$code] = $amount;
5861
if ($code != 'subtotal') {
5962
$code = $code . '_amount';
@@ -72,6 +75,8 @@ public function setTotalAmount($code, $amount)
7275
*/
7376
public function setBaseTotalAmount($code, $amount)
7477
{
78+
$amount = is_float($amount) ? round($amount, 4) : $amount;
79+
7580
$this->baseTotalAmounts[$code] = $amount;
7681
if ($code != 'subtotal') {
7782
$code = $code . '_amount';

0 commit comments

Comments
 (0)