We have a client who is now providing prices to 4 decimal places. These are stored against the product and indexed correctly. When the product is added to the cart, the price in sales_flat_quote_item is rounded to 2 decimal places (but stored as 4).

This is done in the roundPrice function

# app/code/core/Mage/Core/Model/Store.php

public function roundPrice($price)
    return round($price, 2);

Is anybody aware of any consequences of changing this to 4 decimal places? Is it known to cause issues elsewhere?

2 Answers 2


This method is one of the places, where we fought rounding issues in the past. It might be, that you get problems with rounding, if you round more decimal places (sounds weird I know).

But beside f*cking up your prices I don't see a problem.



Did you have any problems with this that you know of? We're having a similar issue based around how we would like VAT (tax) to round nicely so the only way we can get it to work is by using prices with 4 decimal places and then for Magento to consider 4 decimal places when rounding. It seems to be ok on the surface but we're not going to put it live until we're happy with it working.

  • We did actually yes and we had to revert the change. One of the issues was that a payment gateway only accepted pricing to 2 decimal places but we'd store it at 4 - when the response came back, some times Magento wouldn't match the values it and would flag it as fraud. I'd avoid doing it :)
    – Paul
    Oct 22, 2015 at 14:41
  • Hi Gavin, please post your questions to the OP as a comment. SE is a Q&A not a forum ;)
    – 7ochem
    Oct 22, 2015 at 14:49
  • Thanks for the quick reply. I need the product price to be say 16.625 which then with vat added on will be 19.95. It can stay as 2 decimal places as a grand total for the payment gateways so I may need to alter just the product price element and not the global rounding of prices? The issue we have is that our price of 16.625 is getting rounded to 16.63 and then with tax is calculated as 19.956 and then rounded to 19.96. It's having a knock on effect with our google shopping feed too because of the penny difference. @7ochem I tried to comment but my reputation of <50 doesn't allow :(
    – Gavin
    Oct 22, 2015 at 14:59
  • @Gavin, you could also reword your problem into a new question (referring to this question)
    – 7ochem
    Oct 22, 2015 at 15:11
  • just done it :) magento.stackexchange.com/questions/87338/…
    – Gavin
    Oct 22, 2015 at 15:22

Your Answer

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

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