Is there a way to change the default rounding behaviour of Craft Commerce? Here in Switzerland we always round to 5 cents, so amounts like 9.99 or 9.22 don't really exist. Here's an example:

  • 9.99 must be rounded to 10.00
  • 9.98 must be rounded to 10.00
  • 9.97 must be rounded to 9.95
  • 9.96 must be rounded to 9.95
  • 9.95 must stay the same
  • 9.94 must be rounded to 9.95
  • 9.93 must be rounded to 9.95
  • 9.92 must be rounded to 9.90
  • 9.91 must be rounded to 9.90

Product Prices
The product prices we enter manually do follow the guidelines mentioned above, so we never get "odd" prices when putting products to the cart.

Shipping Costs
Shipping costs are also no problem (it's either free or fixed price shipping).

Taxes are a problem for us since we use a tax rate of 7.7% which can lead to "odd" tax amounts (and this leads to "odd" total amounts).

Discounts can also be a problem since they also sometimes lead to "odd" numbers (i.e. a 10% coupon on 14.85 is giving a discount result of -1.49 instead of -1.50).

So is there any way to change the rounding behaviour (either globally or for taxes only)? On the frontend part I think we could achieve that with the Twig filter "number_format", but we need the correct amounts also in the backend.

1 Answer 1


The rounding you are talking about is for cash. The rounding is to nearest 5c because it is likely the smallest denomination in circulation.

Online, with electronic transactions, the base will always be whole cents (or localised equivalent.) Credit Card and electronic purchases can always transaction in these minor units.

Craft Commerce doesn't have the ability to round to cash-based values (likely to be used in POS), but you are welcome to make a feature request here: http://feedback.craftcms.com/

  • Hi @luke, thanks for your answer. Yeah that's true, but my shops will not operate with credit card payments (manual gateway aka invoices only). I have two shops in the pipeline and this rounding issue is absolutely crucial. Is there any way (through a plugin maybe) to achive the desired behaviour?
    – marsask
    Commented Jan 24, 2018 at 8:53

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.