Opencart allows for 8 decimal places as far as I can see.

By using 8 decimal places, you will limit rounding issues to very very rare orders.

If you can show me, where the law says you must use 4 decimal places, then i'll stand corrected.

In the UK, our government (HMRC) allows for rounding issues, because they understand, you can not round down every gross price to a whole number.

Its very unlikely, your government doesn't understand the same thing.

Your only issue, is the customer paying what he/she believes to be the price, and not finding the actual total differs. Therefore you if use the most amount of decimal places you will be fine.

Remember, you are rounding DOWN from price inc tax, to price ex tax to enter it in to opencart product

22 less 21% tax = 18.18181818181818 or for opencarts sake, 18.18181818 either way, when added multiple times, will still equal the correct amount

22 x 2 = 44. (18.18181818 x2 = 36.36363636 + 21% = 43.9999999956 or 44)

Or have I missed something here?

The law ( Italy ) say that in the invoice you must write numbers with 2 decimals, rounded down 1c if the third decimals is <5 or rounded up 1c if the third decimals is >/= 5.

In the shop i set the prices with 4 decimals, why this?...as i wrote if i set 2 decimals in the cart i have a price and in the Total /sub-total ( no vat ) i have different numbers and this create a confusion in the customer. Orders are always hundreds and thousands of items!!!..i'm not talking about 1c of difference but much more.

This is the issue and for this i have the prices with vat with for decimals and the math is correct in the cart/totals...but i have to edit the invoice ( Sub-total, total, Iva, shipping cost mus be 2 decimals!) and i cannot use Paypal module----it's complicated but i have no choice.

I tried that module, with prices included vat in admin, but the problem is still there..i have tried other modules but no way to have the same number in the cart and in the Totals. Maybe with a low number of items it works.

I have understood that the problem is that OC calculate the Tax ( Vat/IVA ) on a not rounded number...instead it would be better to round the price first and then apply the Vat..this way i think all would be fine.

Daniel responded quickly by saying it is a know issue and should be solved in OC 2.0

I posted some fixes which rougly/for most shops would work but it is not a 100% solution unfortunately.

In NL B2C shops should show all total values incl. vat so I know what headache this logic causes.

I tried to open a thread about it in the Bug Report forums for OC 2 but it seems my thread won't be approved to show up...

This needs to be fixed because this way it's useless in germany!

Take a look at the attached screenshot to see the problem

#### Attachments

Screen Shot 2015-05-29 at 22.22.56.png (177.33 KiB) Viewed 8201 times

i have already lost my hope on this issue, i was forced to switch to another platform because as you say in Europe OC is useless. The math only works if you have no decimals in admin product prices....45..100 etc etc..if you put 40,99€ you have the problem in the cart with wrong calculation...I tried everything as to introduce product prices already with VAT in admin but nothing works. The only solution is to show 4 decimals, and you have the right math but you cannot usePayPal..Good luck.

Fabrizio

The price field in the oc_product and oc_product_discount has 4 decimals. I haven't done it yet, but I think it will fix the problem if we changed that to 2.

It is really embarrassing for me, recently won the deal for 4 OpenCart installations, I've just found about this issue... I am not sure how to get this solved properly... please post here if you find out.

An extension that does the job would be fine as well...

Thakns!

Now, I am a little bit confused with what I was doing just couple of minutes earlier and why it seemed an issue.

It looks like this issue is solved for me... I have the total amount (NET + VAT) of 19,00, I've just started to calculate VAT from the total amount with 4 decimals, entered into the price field the amount before VAT and it looks fine... of course...user does not see 4 decimals on the website, just h2.

Regards,

48 x 18.92 = 908,21 ?? Every german accounting office is screaming if they see someting like that....

I should had take another shop system....

Any Ideas?

#### Attachments

2016-11-01 16_13_49-Aufträge.png (9.08 KiB) Viewed 6569 times

DG-Webservices- Webdesign und Programmierung aus Friesland

Just joking, but in our Currency, 1+ 2 Cent pieces of money really dont exist anymore...

Ernie

I am no longer active at the Forum. Please do NOT send me Personal Mails,

they will no longer be replied to.

**My Github OC Site:** https://github.com/IP-CAM

**3'775** FREE OC Extensions, on the World's largest Github OC Repository Archive Site.

A work around is to set the excluding tax price to something that will be closer to 2 decimal places value shown including tax.DaCrash wrote:Hello, the problem is still not solved.

48 x 18.92 = 908,21 ?? Every german accounting office is screaming if they see someting like that....

I should had take another shop system....

Any Ideas?

So instead of a price of 15.9000 which is (15.9000 * 1.19) 18.9210 including tax.

Set the price to 15.8892 which is (15.8992 * 1.19) 18.920048 including tax.

However you will always see these issues at some point.

Other than that you would need to make a lot of changes to the code to combine the tax calculation with the currency conversion so the individual price was always calculated to the correct amount decimal places.

Thank you for this workaround, it's a perfect solution for my website A pain in the butt, but it worksADD Creative wrote: ↑Tue Nov 08, 2016 7:21 pmA work around is to set the excluding tax price to something that will be closer to 2 decimal places value shown including tax.DaCrash wrote:Hello, the problem is still not solved.

48 x 18.92 = 908,21 ?? Every german accounting office is screaming if they see someting like that....

I should had take another shop system....

Any Ideas?

So instead of a price of 15.9000 which is (15.9000 * 1.19) 18.9210 including tax.

Set the price to 15.8892 which is (15.8992 * 1.19) 18.920048 including tax.

However you will always see these issues at some point.

Other than that you would need to make a lot of changes to the code to combine the tax calculation with the currency conversion so the individual price was always calculated to the correct amount decimal places.

It even gets worde when large numbers are ordered.

Solved it by storing product price ex tax with 8 decimals in database.

used phpmyadmin to alter product price, set decimals to 8 and altered product template so 8 decimals can be used.

Koeltechnische deurrubbers eenvoudig online op maat bestellen.

Alle niet stekplichtige onderdelen zoals scharnieren, sloten, randverwarming en verlichting voor alle typen koelingen en vriezers.

https://koelcel-onderdelen.com

Hello victorj,

I have exactly the same problem. Can you please share product template modifications? I could not find the right file...

Thank you.

Koeltechnische deurrubbers eenvoudig online op maat bestellen.

Alle niet stekplichtige onderdelen zoals scharnieren, sloten, randverwarming en verlichting voor alle typen koelingen en vriezers.

https://koelcel-onderdelen.com

Users browsing this forum: No registered users and 7 guests