Sorry, we can't ship to PO Boxes

Do customers miss your "We can't ship to PO Boxes" message?  You can now prevent them from placing the order...

You'll also need to prefix the above expression with a check for null, because during a Shipping Estimate (as opposed to checkout), there is no Address1.  So, the final expression looks like this:

  ShippingAddress.Address1 != null and Regex.IsMatch(ShippingAddress.Address1, "(?i)\b(?:Post\ (?:Office\ )?|P[.\ ]?O\.?\ )?Box\b")


Tags :  PO-Boxes
Comments
Leave your comment
:
thalia@myfootshop.com
Created on: 2/27/2014 5:15 PM
Howdy again-

We recently enabled Guest Checkout on our nopcommerce 3.20 site and it seems that occasionally an order will make it through the system without an email, throwing an error in our admin area.

I'm wondering if there is such a variable as "ShippingAddress.Email" that I could write an ErrorExit for?
support@nopTools.com
Created on: 2/27/2014 10:21 PM
Yes, you can use ShippingAddress.Email - e.g.

ErrorExit    EmailRequired   String.IsNullOrWhiteSpace(ShippingAddress.Email)     "Email is required"


However, it should never happen...  Email is a required field on the checkout address page.
ahkim@ahkim.com
Created on: 4/10/2018 6:56 PM
Once this condition is satisfied, how can I load other shipping methods? e.g. I want to enable Fastway shipping only P.O. box restriction is satisfied.
support@nopTools.com
Created on: 4/10/2018 8:06 PM
ErrorExit would be one of the first lines in the configuration and if the condition is true, then it would not continue processing any other rules.

Just follow the ErrorExit with another rule using Option or OptionExit to call other shipping rate providers -  e.g.          
  Option    Shipping       true          Shipping.FixedOrByWeight
sample@email.tst
Created on: 6/26/2023 5:31 PM
1
sample@email.tst
Created on: 6/26/2023 5:31 PM
1