Tax + discount coupon BUG?
Hello!
PROBLEM:
- Tax calculates wrong when using a discount coupon (fixed amount, including tax) in the checkout.
SETTINGS:
- Zencart version 1.3.8a, fresh install with sample products, no mods installed
- My Store -> 'Display Prices with Tax' = true
- My Store -> 'Zone' = Florida
- Discount coupon fixed amount of $10.00, including tax
- 'ot_coupon' settings are: 'Include shipping' = false, 'Include tax' = true, 'recalculate tax' = none
CHECKOUT BUG: (I have added one product that costs $100.00 including tax) to make the calculation simple)
Sub-Total: $100.00
Store Pickup (Walk In): $0.00
Discount Coupon: 10 : -$10.65 (should be $10.00)
FL TAX 7.0%: $5.89
Total: $90.00
Where is the amount -$10.65 coming from? I have tried different combinations in the ot_coupons module, but with no luck. How is this supposed to work? Is there any documentation about how tax is calculated using different combinations of discounts etc?
:censored:
Best Regards
Erik
Re: Tax + discount coupon BUG?
Hi,
Please change your settings to
include_shipping = FALSE
include_tax = FALSE
recalculate_tax = Standard
and try again.
Re: Tax + discount coupon BUG?
Hi wilt!
I tried your suggestion but ended up with this:
Sub-Total: $100.00
Store Pickup (Walk In): $0.00
Discount Coupon: 10 : -$10.7 (should be $10.00)
FL TAX 7.0%: $5.84 (should be $5.89)
Total: $89.30 (should be $90.00)
:no:
Thank you for a fast reply anyway
/Erik
Re: Tax + discount coupon BUG?
k,
The settings I gave work correctly for me on a clean v138 install.
Do you have DISPLAY_PRICE_WITH_TAX = true set in the admin. If so this would cause the discount coupon value to be inflated by the tax rate.
It is also highly unusual for a US based store to have this setting set to true.
Re: Tax + discount coupon BUG?
Further Note.
If you do have display_price_with_tax = true then there is a bug in 138 regarding the tax calculations for coupons.
I will dig out the relevant threads where I posted a fix for the behaviour
Re: Tax + discount coupon BUG?
Hi again
As I wrote in the original message, the DISPLAY_PRICE_WITH_TAX is set to true.
My live shop is swedish and we only sell to people in Sweden. The reason I showed a 'Florida' example with a clean install is that it simplifies for you to troubleshoot.
In Sweden, almost all 'consumer' shops show prices including tax, and the discount coupons should therefore also include tax.
Thank you for searching the threads...
/Erik
Re: Tax + discount coupon BUG?
Hi
To fix the problem you will need to edit
includes/modules/order_totals/ot_coupon.php
line 73
replace
PHP Code:
if (DISPLAY_PRICE_WITH_TAX == 'true') {
with
PHP Code:
if (DISPLAY_PRICE_WITH_TAX == 'true' && $od_amount['type'] == 'P') {
Line 76
replace
PHP Code:
if ($this->calculate_tax == "Standard") $order->info['total'] -= $tax;
with
PHP Code:
if ($this->calculate_tax == "Standard" && $od_amount['type'] == 'P') $order->info['total'] -= $tax;
line 347
replace
PHP Code:
$ratio = $od_amount['total']/$order_total;
with
PHP Code:
$ratio = $od_amount['total']/($order_total+ ( (DISPLAY_PRICE_WITH_TAX == 'true') ? $orderTotalTax : 0 ));
remember to back files up before editing
2 Attachment(s)
Re: Tax + discount coupon BUG?
Hi
Your code fix solves the problem when using a discount coupon with a value less than the total excluding tax. See attachments. The one using a $100 coupon is false...
ot_coupon settings are:
include_shipping = FALSE
include_tax = FALSE
recalculate_tax = None
(I have tried different combinations but with no luck)
Again, thank you for trying to help me out!
/Erik
Re: Tax + discount coupon BUG?
Hi,
I get correct figures with
include_shipping = FALSE
include_tax = FALSE
recalculate_tax = Standard
display_price_with_tax = true
Sub=Total = 100.00
shipping = 0.00
discount Coupon = -100.00
Tax = 0.00
Total = 0.00
2 Attachment(s)
Re: Tax + discount coupon BUG?
Ok, strange. I get wrong values with the same settings as you. I have attached some screendumps to let you see how everything is set up.
Is there a setting I have missed? :frusty:
/Erik