Deny P.O. Boxes During WooCommerce Checkout

Recently, a question came up of how to deny P.O. Boxes in a WooCommerce installation – something not built in by default, but certainly useful for a lot of companies. Naturally I hit up the Googles, but a lot of the codes and functions were outdated – below, I’ve included a snippet you can add to your functions.php file that fixes the issue.

Note: Be sure to not include the opening <?php on line one OR the closing ?> on Line 29 – those are for code styling purposes only.

Alternatively, I made a quick plugin that does the same thing – upload the .zip to your site or copy the .php file to your plugins folder – click the button to get started.

[button link=”https://danielsantoro.com/wp-content/uploads/2015/08/deny-po-boxes-woocommerce.zip” bg_color=”0099E6″ border=”0099E6″]Download[/button]

Update: December 29, 2016 There is a different way to add code than adding it directly to your functions.php sheet – see the guide here for more information.