2

We have a Magento store where the prices entered by admin are excluding VAT. VAT is added at a rate of 20% and should display on the product page, basket and checkout but for some crazy reason some VAT inclusive prices are always rounding up when they should be rounding to the nearest penny/cent.

Eg:

Price in Magento
41.31

Correct calculation of price
41.31 * 1.2 = 49.572

What Magento should display
49.57

What Magento actually displays
49.58

How can I fix Magento so it displays 49.57?

-1

Open code/core/Mage/Directory/Model/Currency.php

on line no 194

 public function format($price, $options=array(), $includeContainer = true, $addBrackets = false)
        {
    return $this->formatPrecision($price, 2, $options, $includeContainer, $addBrackets);
        }

change this code to:-

public function format($price, $options=array(), $includeContainer = true, $addBrackets = false)
    {
return $this->formatPrecision($price, 0, $options, $includeContainer, $addBrackets);
    }

After Changing This:-

Clear the Cache.

Go to System –> Cache Management Refreh Cache.

If you have not enabled the Cache OR if it didn’t work even after refreshing the cache, then delete the cache folder present inside var (var/cache)

  • 1
    Please do not just edit the core file, you'll loose those changes when you update your shop later. Better create a rewrite for the specific file and just overwrite that one method. – Anna Völkl Jun 15 '15 at 10:31
  • This doesn't solve the problem anyway, your suggested change would make 49.572 display as 50 or 42.22 as just 42 (for example). It just changes the decimal formatting and is nothing to do with the rounding... – zigojacko Aug 8 '16 at 9:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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