Zen Cart Logo
If this is your first visit, check our documentation. To post, register or login.
Forums / General Questions / General Questions / is it me or have i found a bug in 1.3.8a (patched) regarding TAX/Group Pricing/Shippi

is it me or have i found a bug in 1.3.8a (patched) regarding TAX/Group Pricing/Shippi

Locked
This thread is locked. New replies are disabled.
21 Sep 2009, 5:18 PM
#1
shane78 avatar

shane78

Banned

Join Date:
Oct 2008
Location:
newcastle upon tyne (UK)
Posts:
876
Plugin Contributions:
0

Post #1 by shane78

Help..

I have group pricing on my store but it is not calculating the Tax properly when shipping is applied to order.

WITH DICOUNT @50% WITH SHIPPING
Sub-Total = £400
Flat Rate Shipping = £10
Group Discount = -£200
UK VAT at 15% = £30.75
Total: = £240.75
(WRONG - should be Vat = £31.50 - total = £241.50)

WITH DICOUNT @50% WITHOUT SHIPPING
Sub-Total = £400
Free Shipping = 0
Group Discount = -£200
UK VAT at 15% = £30.00
Total: = £230.00
CORRECT

I have played with this all day and it seems that the TAX is not calculated properly when applying Group Discount only when shipping added that is not free.

is it something i have done wrong? or a bug... eitherway, how can i fix this?

22 Sep 2009, 7:04 AM
#2
shane78 avatar

shane78

Banned

Join Date:
Oct 2008
Location:
newcastle upon tyne (UK)
Posts:
876
Plugin Contributions:
0

Post #2 by shane78

Update...

I have done lots of tests, and the problem only happens when paid shipping is applied to orders for a customer with discount via group pricing.

Otherwise tax is calculated no problem on orders + paid shipping + NO discount
Tax is fine on orders + group discount + free shipping

It is only when both paid shipping and group pricing is applied to an order does a Tax calculation error occur.

any ideas?.. anyone else got this problem?.. It is only out by pennies but it is still out and the TAX-MAN is an arse!

22 Sep 2009, 7:49 AM
#3
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Post #3 by kuroi

What tax class do you have set for your flat rate shipping?

It defaults to none, so unless you have added one and adjusted your shipping rate to account for it, the original calculations would be correct.

In the UK, HMRC takes the view that all shipping originating from the UK is a service whose delivery starts here, making it VATable, so any store that is part of a business registered for VAT should apply a tax class for all shipping methods used. But I digress ....

Kuroi Web Design and Development | Twitter

(Questions answered in the forum only - so that any forum member can benefit - not by personal message)

22 Sep 2009, 9:41 AM
#4
shane78 avatar

shane78

Banned

Join Date:
Oct 2008
Location:
newcastle upon tyne (UK)
Posts:
876
Plugin Contributions:
0

Post #4 by shane78

Hi kuroi, thanks for replying...

I have three shipping methods: Free, Flat rate at £10 and table rate by weight (incremented by £10 per 20Kg)
all are set to Tax Class: Taxable Goods. (I used Wilt's instruction on how to set up a store for UK Tax)

Everything is fine with the cart (i believe), until i use the % discount in Group Pricing

----TEST WITHOUT DISCOUNT---
Sub-Total: £200
Business Post (Shipping costs based on overall order weight): £10.00
UK VAT at 15%: £31.50
Total: £241.50
--- CORRECT ---

---TEST WITH DISCOUNT ---
Sub-Total: £200
Business Post (Shipping costs based on overall order weight): £10.00
Group Discount: -£100
UK VAT at 15%: £15.75 (should be £16.50)
Total: £125.75 (should be £126.50)
---INCORRECT---

--TEST WITH DISCOUNT + FREE SHIPPING ---
Sub-Total: £200
Customer Collection: £0
Group Discount: -£100
UK VAT at 15%: £15.00
Total: £115.00
--- CORRECT ---

I think... wow, this is confusing....
So from what i can work out, the TAX is messed up only when using Group Pricing to apply a % discount.... ONLY when the customer has to pay for shipping?.... LOL, this is hurting my head

22 Sep 2009, 9:59 AM
#5
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Post #5 by kuroi

On this basis, I agree with your calculations and assessment. But it's not a surprise. I've had similar problems with tax and coupons. There are some known but very complex problems in there, but we may need to wait until 1.3.9 / 2.0 to get the solutions.

In the meantime, what happens if you move the tax calculation before the group discount? Is the calculation now correct? That's probably not a viable solution as tax not collected due to the discount wouldn't then be accounted for, but it would be interesting to know.

Kuroi Web Design and Development | Twitter

(Questions answered in the forum only - so that any forum member can benefit - not by personal message)

22 Sep 2009, 10:23 AM
#6
shane78 avatar

shane78

Banned

Join Date:
Oct 2008
Location:
newcastle upon tyne (UK)
Posts:
876
Plugin Contributions:
0

Post #6 by shane78

Oh i wouldn't even know what file to look at let alone what blocks of code to move! It's far to complex a problem for me to take on.
I think my best bet is to move on and wait for 1.3.9/2.0

I might have a bash at Dual Pricing - Wholesale Pricing add-on and see what the craic is with that... failing that, I'll just have to let sage 50 work it out. means duplicating some workload but ,,, if it gets the job done... nowt i can do about it.

Thanks for the help... should i post a link to this in the 'report bugs' area?
p.s. is there going to be a 1.3.9?.. i thought it got cancelled because of 2.0?

22 Sep 2009, 10:25 AM
#7
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #7 by drbyte

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

22 Sep 2009, 10:29 AM
#8
shane78 avatar

shane78

Banned

Join Date:
Oct 2008
Location:
newcastle upon tyne (UK)
Posts:
876
Plugin Contributions:
0

Post #8 by shane78

could be.... i need a coffee first tho.. i shall apply and report back this afternoon... Cheers DrByte

22 Sep 2009, 11:41 AM
#9
shane78 avatar

shane78

Banned

Join Date:
Oct 2008
Location:
newcastle upon tyne (UK)
Posts:
876
Plugin Contributions:
0

Post #9 by shane78

Hi... I have played.. and sadly it doesn't apply...
srt9969 had a problem where shipping was being discounted, my shipping is not being discounted (which is good).

but i have been playing about, creating various orders with various levels of % discount. There is a patten depending on the on the level of discount offered.

As i said before this problem only occurs when the user has to pay for carriage (in this case at £10) if they have a %discount assigned to them

at 50% discount there is a short fall on Tax by £0.75
at 25% discount there is a short fall on Tax by £0.37
at 99% discount there is a short fall on Tax by £1.48

regardless of subtotal value, be the item £100 or £1000
btw at 100% discount TAX disappears completely, only leaving the shipping costs without TAX applied..

have I lost you?.. i have lost myself!!! ;-)

this is all way to complex for me... but if i can help with running more test and posting the results let me know

22 Sep 2009, 1:07 PM
#10
wilt avatar

wilt

Oji-san

Join Date:
Jun 2003
Location:
Newcastle UK
Posts:
1,953
Plugin Contributions:
3

Post #10 by wilt

Hi,

This is a known bug and has been fixed in v139. I'm pretty sure there are some other threads out there that address the problem, but probably from the view point of discount coupons.

To fix.

First edit
includes/modules/order_total/ot_shipping.php at approx line 67

original

          $shipping_tax_amount = zen_calculate_tax($order->info['shipping_cost'], $shipping_tax);
          $order->info['tax'] += $shipping_tax_amount;

change to

          $shipping_tax_amount = zen_calculate_tax($order->info['shipping_cost'], $shipping_tax);
          $order->info['shipping_tax'] += $shipping_tax_amount;
          $order->info['tax'] += $shipping_tax_amount;

now edit includes/modules/order_total/ot_group_pricing.php at approx line

original

    if ($this->include_shipping != 'true') $order_total -= $order->info['shipping_cost'];
    if ($this->include_tax != 'true') $order_total -= $order->info['tax'];

change to

    if ($this->include_shipping != 'true') $order_total -= $order->info['shipping_cost'];
    if ($this->include_shipping != 'true') $order_total_tax -= $order->info['shipping_tax'];
    if ($this->include_tax != 'true') $order_total -= $order->info['tax'];

HTH

23 Sep 2009, 11:03 AM
#11
shane78 avatar

shane78

Banned

Join Date:
Oct 2008
Location:
newcastle upon tyne (UK)
Posts:
876
Plugin Contributions:
0

Post #11 by shane78

Fantastic Wilt,

Worked a treat.... i could give you a kiss for that, but im not a mackem.. so i wont.. i'll just say thank you...

thank you