Well... I did all my testing, modifications using a shipping module with tax class set and when I removed this tax class, problems appeared.
I have to rethink everything as I made two assumptions that were wrong:
I thought option 'include shipping' and 'include tax' were here just to choose the limit for discount, which was true for fixed discount, but I realized that it modified how percentage discount are calculated.
And most important, I thought the actual calculation for tax was good... It is if you use free shipping or shipping has a tax class defined, but when tax class is not defined (default in all shipping modules), shipping tax is missing from final tax. Whatever you display prices with or without tax, shipping has always the same value.
I checked and as far as I know, shipping is always taxable. Basic rule for sale tax calculation is:
Taxable amount = Sales - discount + charges
Sales include goods and service provided.
Discount includes sale discount, refunds, non-taxable items...
Charges are shipping fees, handling fees and any other indirect cost incurred to provide goods or services.
Before going further with discount module, this needs to be fixed.
In 'ot_coupon.php', the variable
PHP Code:
$order->info['shipping_tax']
is 0 when no tax class has been defined. In this case, it should be populated by calculating tax (using shop's tax class) from shipping cost considered as a tax included value.
I don't know how to do that...
Bookmarks