Prevent PO Boxes being entered as address at checkout

AlpinaSam
Tourist
3 0 12

Thanks Wolfinator, nowhere else has anyone even provided this info... It's a start!

Anindo
Shopify Partner
555 1 19

Preventing customers from entering PO Boxes as their shipping address during the checkout process is something that is not directly achievable through Shopify. However, if you are not encouraged to ship to PO Box addresses only because they do not get delivered with the carrier, then you can use FedEx Smartpost as a workaround to deliver PO Box shipments. SmartPost is offered by apps like the Multi Carrier Shipping label app or the FedEx Rates Labels & Tracking app.

Product Owner @ PluginHive
Shipping Automation | FedEx shipping | Multi-carrier shipping | Shipment Tracking | Australia Post shipping
0 Likes
Badawis
New Member
1 0 0

I hope you found a solution.  We are in NZ and PO Boxes can be a pain to ship to, our workaround was adding a shipping option specific for PO Boxes that is almost double rural deliveries, we also specified in the shipping option that it is not recommended.

It worked for us.  I hope this could help someone.

 

0 Likes
jimjams
Tourist
5 0 1

Hi @Badawis

How did you specify only PO boxes in your shipping option? We are trying to do a similar thing, breaking out PO Box users to a different method. Thanks.


@Badawis wrote:

I hope you found a solution.  We are in NZ and PO Boxes can be a pain to ship to, our workaround was adding a shipping option specific for PO Boxes that is almost double rural deliveries, we also specified in the shipping option that it is not recommended.

It worked for us.  I hope this could help someone.

 


 

0 Likes
Pburt16
Tourist
8 0 3

Address Validator is only available to Shopify Plus customers ...

 

According to the developer of this app, whom I just spoke to,

Unfortunately, [the reason we can't offer the advanced features of our app to all Shopify plans] is due to a restriction imposed by Shopify. They recently imposed a rule to restrict non-Plus merchants from modifying the checkout experience via the Google Analytics section.

Allowing customers to update an address or providing a means of preventing/blocking incorrect (PO Box) addresses to Shopify store owners is as bare-bones basic a feature as should be automatically included in every plan. What this developer is saying is that it can absolutely be done. What Shopify is saying with this PCI compliance BS is that "we don't want to."



0 Likes
ChadOConnell
New Member
1 0 1

🙋‍

I too just got off a chat trying to figure this out. I offer free shipping to all my customers in the contiguous 48 states, but PO box addresses are approximately an extra $8 to fulfill.

If Shopify can detect a Canadian or Hawaiian address so we can make a special pricing zone, why can't they detect PO boxes so we can at least make a price these addresses differently?

shophelp20
Excursionist
11 0 4

Shopify stores are able to warn customers from entering PO Boxes using the app Mighty PO Box Blocker. The app displays a warning on the shipping option page when a PO Box address is entered.

Kumar2573
Explorer
75 4 8

Hi please add this code.

RESTRICT PO BOXES AS ADDRESSES ON SHOPIFY

<script>

(function($) {
$(document).on('ready page:load page:change', function() {
var regex = /^.*p(.O.|o box|ost office|ost box)/i;
var fieldErrorClass = 'field--error';
var fieldErrorMessageSelector = '.field__message--error';
var errorText = 'Please note: We do not ship to P.O Boxes address';
var $inputs = $("[data-step] [name='checkout[shipping_address][address1]'], [data-step] [name='checkout[shipping_address][address2]']");

var regexCheckFn = function(elem) {
var $current = $(elem);
var $parent = $current.closest('.field__input-wrapper');
var $field = $current.closest('.field');
if (regex.test($current.val())) {
if (!$field.hasClass(fieldErrorClass)) {
$field.addClass(fieldErrorClass);
}
if ($field.find(fieldErrorMessageSelector).length < 1) {
$parent.after("<p class='field__message field__message--error'>"+ errorText +"</p>");
}
return false;
} else {
if ($field.hasClass(fieldErrorClass)) {
$field.removeClass(fieldErrorClass);
}
if ($field.find(fieldErrorMessageSelector).length > 0) {
$field.find(fieldErrorMessageSelector).remove();
}
return true;
}
};

// Call regex check on form submit
$(document).on('submit', '[data-step] form', validateForm);

// Call regex check on blur
$inputs.blur(validateForm);

function validateForm() {
var isValid = true;
$inputs.each(function() {
isValid = isValid && regexCheckFn($(this));
});
if (isValid) {
$("#continue_button").removeAttr("disabled");
} else {
$("#continue_button").attr("disabled", "disabled").removeClass("btn--loading");
}
return isValid;
}
});
})(Checkout.$);


</script>

Pburt16
Tourist
8 0 3

Kumar2573

Please provide additional details how and where to install this script. Would also be helpful if you described what it actually does. 

Kumar2573
Explorer
75 4 8

Please add script on checkout page.