Tax Exemption for AC 7.0.7.14600

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
moustafa
Lieutenant (LT)
Lieutenant (LT)
Posts: 54
Joined: Wed Oct 19, 2011 9:54 pm

Tax Exemption for AC 7.0.7.14600

Post by moustafa » Sat May 17, 2014 3:21 am

Hi there,

I've set up a couple groups that are tax exempt. I also set up the tax rules so that a 0% tax applies to people in these groups. In other words, tax exemption is set in two places: the group settings and the tax rules.

During checkout, no tax shows up. However, once a user places the order, they are charged taxes. This shows in the final receipt (/Checkout/Receipt.aspx) and in the order manager.

If I un-check Tax Exempt from the group settings and keep the tax rule, taxes show up during checkout. If I disable the tax rule and keep the Tax Exempt setting in the group, taxes don't show up during checkout but do in the final receipt and order manager.

So is this a bug? Is there a fix? I can hack the code, but I'd rather not.

Thanks,
Moustafa

moustafa
Lieutenant (LT)
Lieutenant (LT)
Posts: 54
Joined: Wed Oct 19, 2011 9:54 pm

Re: Tax Exemption for AC 7.0.7.14600

Post by moustafa » Sat May 17, 2014 5:26 am

The cart is using the Avalara third party tax provider, and it's the one that's computing the tax.

So it seems that AC gives precedence to the third party tax provider over its own internal classification of the person belonging to a tax-free group. Does this seem right?

Any workarounds or do I need to hack the code?

Thanks,
Moustafa

User avatar
Katie
AbleCommerce Admin
AbleCommerce Admin
Posts: 2651
Joined: Tue Dec 02, 2003 1:54 am
Contact:

Re: Tax Exemption for AC 7.0.7.14600

Post by Katie » Sat May 17, 2014 7:12 am

Hello Moustafa,

Unfortunately, the 7.0.7 version with AvaTax has this issue with tax exempt. At the time it was written, I don't know if the developers intended on ignoring the tax exempt setting in AC. The other tax display settings were ignored as well, so it may have been intentional.

Do you have the source code?

Thanks
Katie
Thank you for choosing AbleCommerce!

http://help.ablecommerce.com - product support
http://wiki.ablecommerce.com - developer support

moustafa
Lieutenant (LT)
Lieutenant (LT)
Posts: 54
Joined: Wed Oct 19, 2011 9:54 pm

Re: Tax Exemption for AC 7.0.7.14600

Post by moustafa » Sat May 17, 2014 9:12 am

Hi Katie,

Thanks for this. Unfortunately, I don't have the source code.

I wonder if there's a workaround. In NavigationHelper.cs, we find GetReceiptUrl(), which redirects the users to /Checkout/Receipt.aspx as a final step in the order placement process.

If I rewrite this function to delete the tax item from the ac_OrderItems table immediately before redirecting, this would seem to solve the problem, no?

I know this is very dirty and I should be lashed with a wet noodle for even suggesting such a thing, but can anyone see anything wrong with this approach?

Thanks,
Moustafa

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: Tax Exemption for AC 7.0.7.14600

Post by jmestep » Mon May 19, 2014 4:31 am

You can delete the tax item, but doing it on the receipt page would be after the order is placed and the order goes to the payment gateway so the payment would be wrong if you are using a payment gateway. Also, by that time the customer order confirmation has already been sent. You would need to delete it on the checkout page or the payment control before the order is actually saved. Before the CheckedOut event on the checkout page.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

moustafa
Lieutenant (LT)
Lieutenant (LT)
Posts: 54
Joined: Wed Oct 19, 2011 9:54 pm

Re: Tax Exemption for AC 7.0.7.14600

Post by moustafa » Mon May 19, 2014 4:40 am

Thanks for the tip, Judy!

I was planning on doing it right before the redirection to the receipt page. However, that might be too late indeed. I'll do it before the CheckedOut event, as you mentioned.

The only issue that remains is orders placed from the admin side, but those should be rather rare.

sdf
Ensign (ENS)
Ensign (ENS)
Posts: 10
Joined: Wed May 26, 2010 1:55 pm

Re: Tax Exemption for AC 7.0.7.14600

Post by sdf » Wed Jul 23, 2014 9:15 pm

Is there a known fix for this if you do have the source code, as opposed to removing items from the Basket before the CheckedOut event?

Thanks

User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5170
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

Re: Tax Exemption for AC 7.0.7.14600

Post by AbleMods » Thu Jul 24, 2014 10:48 am

I just fixed this for another client a few weeks ago. This solution applies to the 7.0.6 release of the Avatax provider. I do not believe the code changed in 7.0.7 but use caution regardless.

in full source, find the CommerceBuilder.Providers/Avalara/Avatax.cs file. In the Commit() routine, find the foreach() that contains the switch() command. Replace it with the following:

Code: Select all

            // BEGIN MOD: AbleMods.com
            // DATE:  07/16/2014
            // the Commit() method is missing the code to properly handle coupons as found in Calculate()
            
            // NEED TO GET TOTALS FOR ORDER COUPONS
            decimal orderCouponTotal = 0;



            // LIST THE ITEMS IN THE ORDER FOR THE TAX REQUEST
            foreach (OrderItem item in order.Items)
            {
                Line line;
                switch (item.OrderItemType)
                {
                    case OrderItemType.Product:
                        line = GetTaxLine(order, item, defaultShipmentId, shipmentAddresses, defaultWarehouseId, warehouseAddresses);
                        break;
                    case OrderItemType.Shipping:
                        line = GetTaxLine(order, item, defaultShipmentId, shipmentAddresses, defaultWarehouseId, warehouseAddresses);
                        line.ItemCode = "SHIPPING";
                        if (string.IsNullOrEmpty(line.TaxCode)) line.TaxCode = "FR020100";
                        break;
                    case OrderItemType.Handling:
                        line = GetTaxLine(order, item, defaultShipmentId, shipmentAddresses, defaultWarehouseId, warehouseAddresses);
                        line.ItemCode = "HANDLING";
                        line.TaxCode = "OH010000";
                        break;
                    case OrderItemType.GiftWrap:
                        line = GetTaxLine(order, item, defaultShipmentId, shipmentAddresses, defaultWarehouseId, warehouseAddresses);
                        line.ItemCode = "GIFTWRAP";
                        break;
                    case OrderItemType.Coupon:
                        // IF THIS IS AN ORDER COUPON, IT CAN'T BE HANDLED VIA LINE ITEM
                        CouponType couponType = GetCouponType(item.Sku);
                        if (couponType == CouponType.Order) orderCouponTotal += Math.Abs((decimal)item.ExtendedPrice);
                        line = null;
                        break;
                    default:
                        line = null;
                        break;
                }
                if (line != null) getTaxRequest.Lines.Add(line);
            }

            // PROCESS ORDER COUPONS
            if (orderCouponTotal > 0)
            {
                foreach (Line line in getTaxRequest.Lines)
                {
                    if (line.ItemCode != "SHIPPING" && line.ItemCode != "HANDLING" && line.ItemCode != "GIFTWRAP")
                    {
                        line.Discounted = true;
                    }
                }
                getTaxRequest.Discount = (decimal)orderCouponTotal;
            }

            // END MOD: AbleMods.com
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

moustafa
Lieutenant (LT)
Lieutenant (LT)
Posts: 54
Joined: Wed Oct 19, 2011 9:54 pm

Re: Tax Exemption for AC 7.0.7.14600

Post by moustafa » Tue Jul 29, 2014 5:40 am

Thanks!

Can you upload a DLL somewhere? I don't have the source code.

User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5170
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

Re: Tax Exemption for AC 7.0.7.14600

Post by AbleMods » Wed Aug 06, 2014 5:23 am

I'm sorry I can't upload a DLL. Contact AbleCommerce and discuss obtaining full source code so the fix can be implemented yourself.
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

Post Reply