bkessler91 Posted September 27, 2014 Share Posted September 27, 2014 CC 5.2.13 (just upgraded from 5.2.12) I am running a sale, and it may be that Coupon codes are messing up tax calculation (6% PA tax) Here is a sale from 9/20/2014 (running 5.2.12) and calculated tax fine note: 6% tax on items and shipping is needed. 2 x 20102M49 ($10.50) $21.00 Subtotal:$21.00 Total Discount :$0.00 Shipping:$5.05 PA tax:$1.56 Total:$27.61 Here are two orders where tax was incorrect, where the customer used a coupon code (today 9/27/2014) 1 x 1867FP14 ($10.99) $10.99 $10.99 1 x 1867FP2 ($10.99) 1 x 1867FG23 ($10.99)$10.99 1 x 7357L ($9.29)$9.29 Subtotal:$42.26 Total Discount :$5.00 Shipping:$5.32 PA tax:$1.28 Total:$43.86 1 x QP6 ($10.00) $10.00 1 x 1867R12 ($8.79)$8.79 1 x TJLgKit ($29.95)$29.95 Subtotal:$48.74 Total Discount :$5.00 Shipping:$5.32 PA tax:$1.47 Total:$50.53 Quote Link to comment Share on other sites More sharing options...
KirkM Posted November 26, 2014 Share Posted November 26, 2014 I have exactly the same issue with a store in California. Tax rate is 8.25% and all is fine if no coupon is used. As soon as a coupon is used, the tax is wrong. Does anyone have an explanation for this? CC 5.2.14 Quote Link to comment Share on other sites More sharing options...
KirkM Posted November 27, 2014 Share Posted November 27, 2014 I have discovered something interesting - with the coupon, the tax rate goes consistently to exactly 4%. There is no tax class / rule in this store with anything set at 4%. There is only the standard tax of 8.25% and a class that is tax exempt (which is assigned to no products). It doesn't solve anything but maybe it is a clue? UPDATE: I have done a bunch of things to see if I can follow this to the issue. I am not sure, but it appears there is a logic error in the get() function in the classes/cart.class.php file. I have been studying it but am not familiar enough with the way this is structured to see it easily. I also have two large programming projects going right now and don't have the time to devote to solving the code problem in this store software. Some help from CubeCart Ltd would be greatly appreciated. I have 3 client stores operating in CA and they are none too happy about this. I would like to file a bug report but can't seem to find the CC bug tracker. Anyone know where that is located? It doesn't even pop up in a Google search, just a few links to forum posts about it being missing. Quote Link to comment Share on other sites More sharing options...
havenswift-hosting Posted November 27, 2014 Share Posted November 27, 2014 HiThe whole way that discount codes and gift certificate redemption works was rewritten as well the tax calculations around shipping were changed in 5.2.13 so that probably explains the change.The old bug tracker was discontinued quite a while ago - your best route is to either log an official support ticket for priority support or if you have a github account and request to be added (https://github.com/cubecart/) then you can create an issue Ian Quote Link to comment Share on other sites More sharing options...
KirkM Posted November 27, 2014 Share Posted November 27, 2014 Thanks for the info. I did file a support ticket and Al is going to take a look. The change in 5.2.13 must be it. I upgraded from 5.2.12 to 5.2.14 for all 3 stores and they started complaining this week when they noticed customers using coupons weren't being taxed enough. Quote Link to comment Share on other sites More sharing options...
KirkM Posted November 29, 2014 Share Posted November 29, 2014 Al Brookbanks has verified the bug and is working on a fix at this time. Quote Link to comment Share on other sites More sharing options...
Al Brookbanks Posted December 10, 2014 Share Posted December 10, 2014 This was fixed by changing; $excluded_ave_tax_rate = ($excluded_tax_total / $excluded_subtotal); $ave_tax_rate = ($ave_tax_rate + $excluded_ave_tax_rate) / 2; $subtotal += $excluded_subtotal; to; if($excluded_tax_total>0) { $excluded_ave_tax_rate = ($excluded_tax_total / $excluded_subtotal); $ave_tax_rate = ($ave_tax_rate + $excluded_ave_tax_rate) / 2; } $subtotal += $excluded_subtotal; in the classes/cart.class.php file. Quote Link to comment Share on other sites More sharing options...
KirkM Posted December 10, 2014 Share Posted December 10, 2014 It is close, but still not completely accurate. It isn't cutting the tax in half anymore, but it is rounding it. The 8.25% rate is being calculated at 8% in the store when you use a coupon. Without a coupon, it is still correct. If you can kill the rounding of the tax percentage, I think you will have it. Thanks Quote Link to comment Share on other sites More sharing options...
Al Brookbanks Posted December 10, 2014 Share Posted December 10, 2014 ok thanks I'll see if I can figure out where that is Quote Link to comment Share on other sites More sharing options...
Al Brookbanks Posted December 10, 2014 Share Posted December 10, 2014 It was rounding the tax to two decimal places. Of course this won't work for 8.25% tax = 0.0825 of four decimals. I changed; $ave_tax_rate = sprintf('%.2F',$ave_tax_rate); to: $ave_tax_rate = sprintf('%.4F',$ave_tax_rate); which from my math (which is shocking) has fixed it??!! Quote Link to comment Share on other sites More sharing options...
KirkM Posted December 10, 2014 Share Posted December 10, 2014 From my math (actually, my iPhone calculator's math), it looks right when I do some random shopping. Thanks very much, I am off to put this into the other two stores. I assume this will be included in the next dot release so I won't have to tag it in my customization notes for my stores. Quote Link to comment Share on other sites More sharing options...
Al Brookbanks Posted December 10, 2014 Share Posted December 10, 2014 Yes it will go into the next release. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.