You can disallow shipping to a PO Box address in WooCommerce by scanning the submitted address fields for the phrase “PO BOX” during checkout validation and blocking the order with an error notice if it’s detected.
Why Block PO Box Deliveries
- Certain carriers or delivery methods (like courier-only shipping) can’t deliver to PO boxes at all
- Products requiring a signature or physical street address need a real delivery location
- Catching this at checkout avoids costly failed deliveries and manual order cancellations later
Step 1: Check the Address Fields for “PO BOX”
/**
* Block checkout if the shipping or billing address contains a PO Box
* Add to your child theme's functions.php
*/
add_action( 'woocommerce_after_checkout_validation', 'block_po_box_addresses_at_checkout' );
function block_po_box_addresses_at_checkout( $posted ) {
$address_1 = isset( $posted['shipping_address_1'] ) ? $posted['shipping_address_1'] : $posted['billing_address_1'];
$address_2 = isset( $posted['shipping_address_2'] ) ? $posted['shipping_address_2'] : $posted['billing_address_2'];
$clean = array( ' ', '.', ',', '-' );
$address_1 = strtolower( str_replace( $clean, '', $address_1 ) );
$address_2 = strtolower( str_replace( $clean, '', $address_2 ) );
if ( strpos( $address_1, 'pobox' ) !== false || strpos( $address_2, 'pobox' ) !== false ) {
wc_add_notice( 'Sorry, we are unable to ship to PO Box addresses. Please enter a physical street address.', 'error' );
}
}

Troubleshooting
Valid Addresses Are Being Blocked by Mistake
The check looks for the literal string “pobox” after removing spaces and punctuation, so an address containing an unrelated word combination could theoretically trigger a false positive. Test with real customer address formats and adjust the match pattern if needed.
Customers Can Still Bypass the Check by Abbreviating Differently
This pattern-based approach won’t catch every possible PO box abbreviation (like “P.O. Box” written unusually or in another language). Expand the check to include additional common variants relevant to your customer base.
Frequently Asked Questions
Does this check the billing address or the shipping address?
It checks shipping fields first and falls back to billing fields if separate shipping isn’t enabled, since that’s what actually determines the delivery address.
Can I allow PO Box addresses for certain products only?
Yes, check the cart contents for a specific product or category before running the PO Box validation, and skip the block entirely if none of those items are present.
Will this stop the order from being placed, or just show a warning?
Using wc_add_notice() with the ‘error’ type actually blocks checkout completion — the customer must correct the address before the order can go through.
Conclusion
A pattern-matching check on the address fields is a practical way to disallow shipping to a PO Box address in WooCommerce, stopping problematic orders before they’re placed rather than after. Test thoroughly with real-world address formats, since PO Box entries can be written in more than one way.
See also How to Add a Shipping Notice on the WooCommerce Checkout Page. Then read How to Hide Other Shipping Rates When Free Shipping Is Available in WooCommerce.
Prefer no code? All-in-One Utilities Woo Add-on adds over 50 WooCommerce features, so you can switch them on without code.