Automattic\WooCommerce\Blocks\Domain\Services

CheckoutFields::is_customer_field()publicWC 1.0

Returns true if the given key is a valid customer field.

Customer fields are fields saved to the customer data, like address and contact fields.

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

Хуков нет.

Возвращает

true|false. True if the field is valid, false otherwise.

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

$CheckoutFields = new CheckoutFields();
$CheckoutFields->is_customer_field( $key );
$key(строка) (обязательный)
The field key.

Код CheckoutFields::is_customer_field() WC 9.8.1

public function is_customer_field( $key ) {
	return in_array( $key, array_intersect( array_merge( $this->get_address_fields_keys(), $this->get_contact_fields_keys() ), array_keys( $this->additional_fields ) ), true );
}