WC_Customer::has_shipping_address()
Indicates if the customer has a non-empty shipping address.
Note that this does not indicate if the customer's shipping address is complete, only that one or more fields are populated.
Method of the class: WC_Customer{}
No Hooks.
Return
true|false
.
Usage
$WC_Customer = new WC_Customer(); $WC_Customer->has_shipping_address();
Changelog
Since 5.3.0 | Introduced. |
WC_Customer::has_shipping_address() WC Customer::has shipping address code WC 9.6.1
public function has_shipping_address() { foreach ( $this->get_shipping() as $address_field ) { // Trim guards against a case where a subset of saved shipping address fields contain whitespace. if ( strlen( trim( $address_field ) ) > 0 ) { return true; } } return false; }