Tax Calculation Method Based On – Preferred Setting in Magento 1.9

magento-1.9priceroundingtax

I have a store that is configured to store product prices as inclusive of tax. In the tax configuration, I have 'Tax Calculation Method Based On' set to Total.

On some orders that have discounts, I have noticed strange rounding issues. For example, an order that contains 3 lines, totalling £290, with a discount of £65, has one of the order lines with a line total of £55.01, instead of £55 (which is the correct product price) – making the order total £225.01, rather than £225.

What is the cause of the above, and can changing the 'Tax Calculation Method Based On' setting influence this?

Best Answer

This is probably related to the famous magento rounding bug.

As a solution you can copy /app/code/core/Mage/Core/Model/Store.php file to /app/code/local/Mage/Core/Model/Store.php and modify the roundPrice() method to round with 4 digits:

public function roundPrice($price)
{
    return round($price, 4);
}
Related Topic