The following functionality prevents your customers from shipping to PO Box addresses.
Paste this javascript in the “footer” textarea of the “Add custom header and footer code to your templates” option in your store admin's Template Configuration Settings.
{% if context == "checkout" %} <script> var validatePO = function() { var addressString = ""; $("[name$='_address1'],[name$='_address2']").not("[name^='billing']").each(function() { addressString += this.value; }); addressString = addressString.replace(/\./g,""); addressString = addressString.replace(/ /g,""); addressString = addressString.toLowerCase(); if(addressString.indexOf('pobox') != -1) { alert("We can not ship to a PO Box shipping address. Please choose a different shipping address location."); return false; } else { return true; } }; FC.client.on('customer-login.done', validatePO); FC.client.on('customer-address-change', validatePO); FC.client.on('checkout-submit', validatePO); $("body").on("change", "[name$='_address1'],[name$='_address2']", function() { if (this.name.indexOf("billing")) { var address = FC.json.shipping_address; var multiship = this.name.match(/shipto_(\d+)/); if (multiship) { address = FC.json.multiship_data[multiship[1]]; } if (validatePO() && FC.util.addressHasLocationInfo(address)) { FC.client.event('customer-address-change.done').trigger({ "fields":{}, "address": address }); } } }); </script> {% endif %}