Skip to content

Commit 6c9a97c

Browse files
jayankaghoshShikha Mishra
authored and
Shikha Mishra
committed
use round instead of number_format to round the total amount
1 parent b6f9b6e commit 6c9a97c

File tree

1 file changed

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

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function __construct(
5656
public function setTotalAmount($code, $amount)
5757
{
5858
/* (Fixes issue #18027) Round the total amount to 4 decimal places, to avoid floating point overflows */
59-
$amount = is_float($amount) ? (float)number_format($amount, 4, ".", "") : $amount;
59+
$amount = is_float($amount) ? round($amount, 4) : $amount;
6060

6161
$this->totalAmounts[$code] = $amount;
6262
if ($code != 'subtotal') {
@@ -77,7 +77,7 @@ public function setTotalAmount($code, $amount)
7777
public function setBaseTotalAmount($code, $amount)
7878
{
7979
/* (Fixes issue #18027) Round the total amount to 4 decimal places, to avoid floating point overflows */
80-
$amount = is_float($amount) ? (float)number_format($amount, 4, ".", "") : $amount;
80+
$amount = is_float($amount) ? round($amount, 4) : $amount;
8181

8282
$this->baseTotalAmounts[$code] = $amount;
8383
if ($code != 'subtotal') {

0 commit comments

Comments
 (0)