WC_Customer::has_shipping_address()publicWC 5.3.0

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.

Метод класса: WC_Customer{}

Хуков нет.

Возвращает

true|false.

Использование

$WC_Customer = new WC_Customer();
$WC_Customer->has_shipping_address();

Список изменений

С версии 5.3.0 Введена.

Код WC_Customer::has_shipping_address() WC 8.7.0

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;
}