WordPress.org

Forums

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

  1. kjoy
    Member
    Posted 1 year 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 1 year ago #

    thanks ya. i try it.. :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce - excelling eCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic