I notice that in the release notes for Magento 1.8.0 (http://www.magentocommerce.com/knowledge-base/entry/ce-18-later-release-notes) it says the following:-

"Specifying that prices display in the web store excluding tax and setting a 20% tax rate (or discount rate) now calculates the grand total correctly. It is now possible to have grand totals in amounts like 6.99, 9.99, or 99.99—regardless of the currency units used in the web store. "

But, it does not say how to achieve this?

I have a store where the prices are entered ex VAT. VAT is 20% - and this is then applied to the product price and the Including VAT price shown on the front end.

I wish to have a final including VAT price for a product being £9.99

But - if I enter 8.32 in the admin Price - it results in 9.98 on the front end. If I enter 8.33 it results in 10.00 on the front end.

How do I achieve the £9.99 price that the release notes say is now possible with a Tax rate of 20%?


1 Answer 1


Try filling in the price 8.325 since the price supports up to 4 decimal places.
In this case you should get the final price like this:

8.325 * (1 + 20/100) = 8.325 * 1.2 = 9.99

Apparently I was wrong. Sort of...
If you enter the price as 8.325 it will be saved in the db as 8.325 and everything will work correctly. This part I got right.
But in the backend you will see the price as 8.33 and if you hit save again you will have it in the db as 8.33. This is the part I was wrong about.
Everything happens because of the input renderer for the price attributes. The Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Price class is used to render the price inputs.
At the end of the class there is this method:

public function getEscapedValue($index=null)
    $value = $this->getValue();

    if (!is_numeric($value)) {
        return null;

    return number_format($value, 2, null, '');

This makes the prices show with only 2 decimals even if in the db there are 4 of them.
I guess you have to override this method and replace

`return number_format($value, 2, null, '');`


`return number_format($value, 4, null, '');`

Most probably this will solve your issue and let you fill in 4 decimal numbers without the fear of the value getting modified on the next save.

  • Really? Is there a setting for that? mine always rounds to 2dp.
    – Richard
    Commented Nov 4, 2014 at 10:54
  • On frontend the prices are shown by default with 2 decimals by default, but in the backend you should be able to fill in 4 decimals as far as I know...I will double check and let you know
    – Marius
    Commented Nov 4, 2014 at 10:55
  • damn it...you are right. I remember this working on older versions. I will dig deeper and come back with a working solution...hopefully.
    – Marius
    Commented Nov 4, 2014 at 10:57
  • @Richard. See my update. Maybe it helps.
    – Marius
    Commented Nov 4, 2014 at 11:09
  • Hah, you're good.
    – Richard
    Commented Nov 4, 2014 at 11:11

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.