The solution consists of 2 steps:
1. Improve the accuracy of calculations by working with 4 decimal places or more if necessary. To do this, go to International / Localization / Currencies. Edit the currency and set the number of decimals to 4.
2. Format prices for display to 2 decimal places. For this, the /src/Core/Localization/Number/Formatter.php file must be edited as follows:
On line 103, within the format function, add the code "my code" as below to round prices to 2 decimal places:
public function format($number, NumberSpecification $specification) { // my code $number=round($number,2); // my code ...
On line 138, comment out the following statement to override it
//return $formattedNumber;
And add this code to remove the last 2 decimal places on the right "00", since otherwise the prices are rounded but with 4 decimal places:
// my code return substr($formattedNumber,0,-2); //Remove the last 2 digits ("00") // my code