WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
Disable shipping to PO Box (2 posts)

  1. kjoy
    Member
    Posted 11 months ago #

    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/

  2. otakatik
    Member
    Posted 11 months ago #

    thanks ya. i try it.. :)

Reply

You must log in to post.

About this Plugin

About this Topic