Magento 1.9.2: 5-cents Price Rounding

Today I am working on a Magento site for a Switzerland client which requires the implementation of Rappen Rounding, a 5-cents rounding for the total price for every transaction.

I actually found an extension on GitHub for that, but it was not compatible with my Magento install. I am not sure if it is not compatible with Magento 1.9.2 or conflicting with any other extensions, it just didn't work.

After digging into Magento core codes, I found that there is a simple workaround for this functionality, though we have to override Magento's core. Please be advised that this is not the best practice, it is just a simple workaround. If you want a better functionality and compatibility with future Magento updates, you'd better build a custom module / extension for that.

Here's what I did as a workaround:

  1. Override Magento's core by copying
  2. Edit the new copied file on the
    function roundPrice($price){} 
  3. Replace the line
    return round ($ price, 2);
    return round($price * 2, 1)/2; 
  4. Save
  5. Flush Magento Cache, and it's done!

Let me know if it helps!

Written on August 25, 2016