Skip to content

Commit 923c26a

Browse files
committed
Penny rounding error in catalog rule
Added condition to check PHP version
1 parent 468bccc commit 923c26a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

app/code/Magento/Directory/Model/PriceCurrency.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,13 @@ protected function getStore($scope = null)
153153
public function round($price)
154154
{
155155
// To fix rounding error in PHP 8.4
156-
return round(
157-
floatval((string) $price),
158-
2
159-
);
156+
if (version_compare(PHP_VERSION, '8.4', '>=')) {
157+
return round(
158+
floatval((string) $price),
159+
2
160+
);
161+
}
162+
return round((float) $price, 2);
160163
}
161164

162165
/**

0 commit comments

Comments
 (0)