R6 ship method handling fee charged even shipping is zero

For general questions and discussions specific to the AbleCommerce GOLD ASP.Net shopping cart software.
Post Reply
User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5170
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

R6 ship method handling fee charged even shipping is zero

Post by AbleMods » Fri Dec 20, 2013 8:01 am

Just wanting to confirm a (very rare) bug I found in ship rate calculation. Here are the steps to reproduce:

Create a product. Give it a price of $ 30.00.
Create a product coupon. Make it give 100% discount, apply to a specific product (the one you just created), all groups etc.
Create a vary-by-cost shipping method. Make it charge 10% for any range of cost. Set it to charge a $ 1.00 handling fee.

Now try to buy the product. In checkout, you would expect shipping to come back as $ 4.00. This is comprised of $ 3.00 for the 10% cost and the $ 1.00 fee. The system correctly calculates $ 4.00. All is well.

Now apply your free product coupon.

Shipping goes to $ 1.00. It should go to $ 0.00 since there is no longer a product charge. It's still charging the fee even though the rate results in zero.

I believe the solution (requires full source code) is to modify /Shipping/ShipMethod.cs in the GetShipRateQuote() method. Near the end of the method, add a statement to test if minimum purchase is specified BEFORE applying the handling fee to the rate being returned.

Code: Select all

            // ADD ADDITIONAL SURCHARGE DEFINED FOR THIS SHIP METHOD
            // BEGIN MOD: AbleMods.com
            // DATE:  12/20/2013
            // only add surcharge (fee) if shipment meets minimum purchase requirement of this ship method
            if (this.MinPurchase > 0 && shipment.GetItems().TotalProductPrice() > 0)
            {
                decimal surchargeAmount;
                if (AlwaysConvert.ToBool(this.SurchargeIsPercent))
                    surchargeAmount = Math.Round(((decimal)quote.Rate / 100) * (decimal)this.Surcharge, 2);
                else surchargeAmount = this.Surcharge;
                if (this.SurchargeIsVisible)
                    quote.Surcharge = surchargeAmount;
                else quote.Rate += surchargeAmount;
            }

            // END MOD: AbleMods.com
            return quote;
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

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

Re: R6 ship method handling fee charged even shipping is zero

Post by Katie » Fri Dec 20, 2013 9:04 am

Shipping goes to $ 1.00. It should go to $ 0.00 since there is no longer a product charge
I believe the handling charge is kept separate of any calculated shipping cost. In other words, there is nothing in the code to remove the handling charge if the shipping cost ends up being 0. So, I don't think this is a bug. Like you said, this is a probably a rare situation, so a little custom code tweak should take care of this.
Thank you for choosing AbleCommerce!

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

Post Reply