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;