I have customized the magento's price rounding by changing in app/code/local/Mage/Core/Model/Store.php file's Round function and set the precision to 4 instead of 2 and also do changes in app/code/local/Mage/Paypal/Model/Api/Abstract.php for _exportLineItems function's $request[sprintf($privateFormat, $i)] = $value; line to $request[round($privateFormat,2)] = $value;

After this everything is working fine. But Now I have got an issue, When open paypal account and then via activity open the order for payment details it shows me different amount.

Below is image from my store: enter image description here

And this one is from paypal:

enter image description here

One more thing my store has 7% tax and all products are incl. of tax.

Suggest where to changes to get the same amount details in paypal account.

enter image description here

1 Answer 1


You can try this solution. Perhaps this is just the problem described in P.S.

Try the first solution in the answer, where the following files change:

app/code/core/Mage/Tax/Model/Sales/Total/Quote/Tax.php:1392 app/code/core/Mage/Tax/Model/Sales/Total/Quote/Subtotal.php:719

To correct the rounding error, you probably only need to improve the accuracy of the delta calculation. You may need to roll back the changes you made to rounding.


This is irrelevant to the question, but overwriting the core files this way (app/code/local/Mage/Core/Model/Store.php) is not the best solution.

Do not modify or hack core files! Do a rewrite!

You can create a module where you rewrite only the function you need. This allows you to make the Magento update more safely.

  • thanks but I already try these to make changes in above files and also in Store.php file after coping them in local. I just updated the question with new screen-shot, Take a look.
    – Yogita
    May 18, 2018 at 7:26
  • @Yogita, you only need to make changes to these two files: app/code/core/Mage/Tax/Model/Sales/Total/Quote/Tax.php, app/code/core/Mage/Tax/Model/Sales/Total/Quote/Subtotal.php and also roll back the changes made in app/code/local/Mage/Core/Model/Store.php. The result of what changes shown on the screenshot? Perhaps also this link will be useful for understanding the problem.
    – Victor S.
    May 18, 2018 at 7:50
  • @Yogita, it seems to me that the mistake is precisely in calculating the tax in your case (the tax should be 6.21, not 6.22). in your case rounding to 2 decimals will give 6.21, as seen in the screenshot. Magento uses addition with the delta to avoid deterministic behavior with a rounding of 0.5. The delta can be either positive or negative. It looks like if the rounding of the delta was not accurate enough (2 decimal places by default) and would give this error in calculating the tax.
    – Victor S.
    May 18, 2018 at 8:10
  • but I want the tax like the way I show in screen-shot, after that tax is calculating the way I want but some issues on paypal and sometimes with grandtotal amount. I want the tax should be 6.22
    – Yogita
    May 18, 2018 at 8:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.