Automattic\WooCommerce\Blocks\Domain\Services

CheckoutFields::deregister_checkout_field()publicWC 1.0

Deregister a checkout field.

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

Хуков нет.

Возвращает

null. Ничего (null).

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

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

Код CheckoutFields::deregister_checkout_field() WC 9.4.2

public function deregister_checkout_field( $field_id ) {
	if ( empty( $this->additional_fields[ $field_id ] ) ) {
		return;
	}

	$location = $this->get_field_location( $field_id );

	// Remove the field from the fields_locations array.
	$this->fields_locations[ $location ] = array_diff( $this->fields_locations[ $location ], array( $field_id ) );

	// Remove the field from the additional_fields array.
	unset( $this->additional_fields[ $field_id ] );
}