Price Rounding – How to Round Price to 4 Decimal Places

pricerounding

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?

Best Answer

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.

So: TEST TEST TEST.

Related Topic