WordPress.org

Support

Support » Plugins and Hacks » WooCommerce » Disable shipping to PO Box

Disable shipping to PO Box

  • I can’t ship to PO Boxes so is there a way I can disable shipping to PO Boxes? My store is at http://www.snakeriverroastingco.com/staging

    I added the code below to my functions.php file but it isn’t doing anything.

    function deny_pobox_postcode( $posted ) {
     global $woocommerce;
    
     $postcode = ( isset( $posted['shipping_address_1'] ) ) ? $posted['shipping_address_1'] : $posted['billing_address_1'];
    
     $postcode = strtolower(str_replace( ' ', '', $postcode ));
    
     if ( strstr( $postcode, 'pobox' ) ) {
       $woocommerce->add_error( "Sorry, we cannot ship to PO BOX addresses." );
     }
    }

    http://wordpress.org/plugins/woocommerce/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Disable shipping to PO Box’ is closed to new replies.
Skip to toolbar