Automattic\WooCommerce\Blocks\Domain\Services

CheckoutFields::get_field_location()publicWC 1.0

Gets the location of a field.

Method of the class: CheckoutFields{}

No Hooks.

Returns

String. The location of the field.

Usage

$CheckoutFields = new CheckoutFields();
$CheckoutFields->get_field_location( $field_key );
$field_key(string) (required)
The key of the field to get the location for.

CheckoutFields::get_field_location() code WC 9.8.5

public function get_field_location( $field_key ) {
	if ( ! $this->is_field( $field_key ) ) {
		return '';
	}
	foreach ( $this->fields_locations as $location => $fields ) {
		if ( in_array( $field_key, $fields, true ) ) {
			return $location;
		}
	}
	return '';
}