Get more for your money each Wednesday with big savings on selected extensions. Shop this week's deals.
Product Icon

WooCommerce Shipping

by Woo
Print USPS and DHL labels right from your WooCommerce dashboard and instantly save on shipping. WooCommerce Shipping is free to use and saves you time and money.

Validate Address, Before Submit and Hide Shipping Methods if Po Box Shipping is Unavailable

customer->get_shipping_address_1() ) ) ? $woocommerce->customer->get_shipping_address_1() : $woocommerce->customer->get_billing_address_1();
$postcode = ( !empty( $woocommerce->customer->get_shipping_postcode() ) ) ? $woocommerce->customer->get_shipping_postcode() : $woocommerce->customer->get_billing_postcode();
$replace = array(” “, “.”, “,”);
$address2 = strtolower( str_replace( $replace, ”, $address ) );
if ( strstr( $address2, ‘pobox’ ) ) {
foreach ($available_shipping_methods as $shipping_method => $value) {
if( strpos( $shipping_method, $shipping_method_to_hide, $shipping_method_to_hides ) !== false ) {
unset($available_shipping_methods[$shipping_method]);
}
}
}
return $available_shipping_methods;
}
?>

Author

Current Status

Open

Last updated: March 24, 2021

0 comments

Log in to comment on this feature request.

Use of your personal data
We and our partners process your personal data (such as browsing data, IP Addresses, cookie information, and other unique identifiers) based on your consent and/or our legitimate interest to optimize our website, marketing activities, and your user experience.