Page 1 of 1

Another rounding issues thread

Posted: Wed Jul 31, 2019 10:36 pm
by rhorne
Hello, we have a rounding issue I'm unable to get to the bottom of. I can't be the first to have experienced this issue but I haven't been able to find a solution yet.

We have a product whose price is £1.71 ex Vat.
Plus 20% Vat is £2.052.
The store shows £2.05.

The customer wants to order 60 and rightly expects the price to be 60 x £2.05 = £123
But of course Opencart calculates 60 x £2.052 with the result being £123.12

Short of setting all products such that their plus vat price gives me clean whole numbers I don't know what else I can do that doesn't involve modifying the base Opencart code and I'd rather not do that unless absolutely necessary.

Re: Another rounding issues thread

Posted: Thu Aug 01, 2019 1:21 am
by ADD Creative
As you have probably found from searching the form, the workarounds are as you have suggested. To change the ex. tax price so when tax is added the result is nicer number. This probably won't help if selling in multiple currencies.

Or to make changes to the code for total calculations to add rounding or calculate the total after formatting for display. These changes would be need to be made in quite a few places, such as cart, checkout, admin, payment modules, etc.

The only other option would be to change the 'Decimal Places' setting for that currency to be more than 2. This might be undesirable visually and might just push the issue to the next decimal place, depending on your prices. Some payment modules may have issue with the change in decimal places.

Re: Another rounding issues thread

Posted: Thu Aug 01, 2019 4:08 pm
by rhorne
How does everyone else deal with this? Do you just hope the customer doesn't notice or care as the differences are usually insignificant?

I feel that modifying the core Opencart files to fix this is a recipe for disaster, and I don't even know exactly which files I'd need to amend in order to even achieve this. It surprises me that there are no extensions to fix this either, seems like it should be a bigger deal.

Re: Another rounding issues thread

Posted: Fri Aug 02, 2019 5:06 am
by ADD Creative
It depends what the store is selling. If they are selling larger value items that only get 1 or 2 purchased at a time, it's not likely that anyone will notice it to be to be an issue.

Some sites are business 2 business 2 display prices ex. VAT anyway, so again less likely to notice. One site I know is modified the cart to display the prices ex. VAT even when product prices displayed prices including VAT.