Automattic\WooCommerce\Blocks\Domain\Services

CheckoutFields::is_customer_fieldpublicWC 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.

Method of the class: CheckoutFields{}

No Hooks.

Returns

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

Usage

$CheckoutFields = new CheckoutFields();
$CheckoutFields->is_customer_field( $key );
$key(string) (required)
The field key.

CheckoutFields::is_customer_field() code WC 9.9.3

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