From an old post, Feb, 2009: PO Box addresses would not render an option for UPS shipment. Was that a customization or should that be working now? We are having problems with people providing PO Boxes then selecting UPS as a shipping method.
Any workaround for this?
Thanks
Omitting UPS shipping from PO Box addresses
-
- Commander (CMDR)
- Posts: 139
- Joined: Wed Mar 31, 2010 8:59 pm
Re: Omitting UPS shipping from PO Box addresses
This is something that we handled in 7.0.5 work out of the box.
http://bugs.ablecommerce.com/show_bug.cgi?id=6878
Here is the workaround for you. Edit your ConLib/OnePageCheckout.ascx.cs file and locate following code lines
then update it as below
that's it. Actually all I am doing here is to see if shipping address contains PO Box address then hide those methods associated with UPS.
http://bugs.ablecommerce.com/show_bug.cgi?id=6878
Here is the workaround for you. Edit your ConLib/OnePageCheckout.ascx.cs file and locate following code lines
Code: Select all
foreach (ShipRateQuote quote in rateQuotes)
{
Code: Select all
foreach (ShipRateQuote quote in rateQuotes)
{
System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(@"\b[P|p]?(OST|ost)?\.?\s*[O|o|0]?(ffice|FFICE)?\.?\s*[B|b][O|o|0]?[X|x]?\.?\s+[#]?(\d+)\b");
if (quote.ShipMethod.ShipGateway != null && quote.ShipMethod.ShipGateway.Name == "UPS OnLine® Tools" && (regex.IsMatch(shipment.Address.Address1) || regex.IsMatch(shipment.Address.Address2)))
{
continue;
}