I have a client that would like to hide the UPS shipping once an order is over $100. Currently, the Free Shipping is showing on the dropdown, but so is the UPS and some customers are choosing the UPS shipping which is a charge and they are missing the Free shipping.
So in a nutshell, the UPS shipping should be a choice when the order is below $100, and the Free Shipping should be the only choice when the order is $100 or more.
Thoughts?
Thanks!
Hiding certain shipping options depending on basket total
- Intelliflex
- Lieutenant (LT)
- Posts: 78
- Joined: Tue Feb 17, 2004 7:51 pm
Re: Hiding certain shipping options depending on basket total
Take a look at the ShipmentList_ItemDataBound function in the Conlib\OnePageCheckout.ascx.cs file.
You can get the product total at the top of that function or set it to a boolean:
then inside the foreach loop add a check before adding the UPS shipping method. Something like this:
If you're using the shipping estimator on the basket page you'll want to do the same thing there.
You can get the product total at the top of that function or set it to a boolean:
Code: Select all
bool useUPS = _Basket.Items.TotalProductPrice() < AlwaysConvert.ToDecimal("100.00");
Code: Select all
foreach (ShipRateQuote quote in rateQuotes)
{
LSDecimal totalRate = TaxHelper.GetShopPrice(quote.TotalRate, quote.ShipMethod.TaxCodeId, null, new TaxAddress(shipment.Address));
string formattedRate = totalRate.ToString("ulc");
string methodName = (totalRate > 0) ? quote.Name + ": " + formattedRate : quote.Name;
if (quote.Name.Contains("UPS")) {
if (useUPS) {
localQuotes.Add(new LocalShipRateQuote(quote.ShipMethodId, methodName, formattedRate));
}
}
else {
localQuotes.Add(new LocalShipRateQuote(quote.ShipMethodId, methodName, formattedRate));
}
}