Page 1 of 1

Tax on OrderTotal issue

Posted: Thu Oct 09, 2014 8:12 pm
by rokdazone
There is a major issue with opencart that dates back at least to 1.5.x.

The problem is that taxes for order totals doesn't seem to get logged anywhere. When the customers places the order in checkout the tax is there.

When you later are viewing the order in admin the taxes just aren't there (because they aren't logged anywhere).
If you are developing some kind of integration to a business-system/SaaS-provider, this quickly become a nightmare as you will try to recalculcate the tax in in reverse based on customer address etc. etc.

In one/some of the OC 1.5.x releases i know there was a "order_total_tax" table, that now is removed again?

I have talked with a representative/employee at the Swedish tax office that claims that for this e-commerce system to apply correctly to swedish tax rules, the following things must be fixed.


1. Tax must be logged separatly (on everything, not just products)
2. There must also be possible to apply tax to stuff like Vouchers, Coupons, Rewards etc. (all discounts). Yes, discounts might also require tax according to the swedish tax office.

What applies to the swedish tax office, could possible apply to tax office's in many other countries.

Many business-systems/SaaS-providers also require you to send in the tax in percent (and not the tax amount), like (6,12,25). So if a new field "tax_percent" existed everywhere where tax was logged, this would also greatly make things easier because then you would't need to calculate the percent (using the price, total, tax field).

Any thought's on this? Maybe i'm completely wrong about this and taxes get logged somewhere. However, any thought's on this is greatly appreciated, because i can't be the first to have noticed this.

Re: Tax on OrderTotal issue

Posted: Thu Oct 09, 2014 10:49 pm
by Johnathan
Are you referring to the tax amount (e.g. $15.00) or the tax rate (e.g. 20%) being stored? Tax amounts are stored in the "order_total" table, with a code of "tax". You can filter them that way (and the admin panel does for reporting taxes).

Re: Tax on OrderTotal issue

Posted: Fri Oct 10, 2014 2:14 pm
by rokdazone
But the row with the code of "tax" in table order_total is the total tax amount for the order. I must know the individual tax amount/percent for each logged fee in order_total. I think the best solution should be to log tax separatly, just as in table order_product. Do you know of any method/way to retrieve logged tax for a individual fee (payment fee/shipping)? Please let me now :)

What i'm really after is a method to retrieve the tax percent for each order total fee individually (on the admin side) so that when i sum the (products + taxes) with order total fees etc it should add up to the order total amount.

Re: Tax on OrderTotal issue

Posted: Sat Oct 11, 2014 10:39 pm
by Johnathan
If you create different Tax Rates and Tax Classes to apply to the different areas (products, fees, shipping, etc.) then they'll each be logged separately in the "order_total" table. You could then pull them individually based on their title.

It's not a perfect solution, but it doesn't require modifying anything in OpenCart.

Re: Tax on OrderTotal issue

Posted: Mon Oct 13, 2014 8:21 pm
by rokdazone
So, if i have different Tax Rates and Tax Classes set on products, fees and shipping, the tax (for the individual fee) is logged separatly in the order_total table? I have to check that out.

EDIT: Just took a look in the model file for a random payment module (catalog/model/payment/amazon_checkout.php) and there are references there to a "order_total_tax" database table. However, there is no table with that name in the database (using oc, very strange indeed. So, it seems like somebody added support to log tax separatly, then changed his mind but forgot to remove code :)