Automattic\WooCommerce\Blocks\Domain\Services

CheckoutFields::deregister_checkout_field()publicWC 1.0

Deregister a checkout field.

Method of the class: CheckoutFields{}

No Hooks.

Return

null. Nothing (null).

Usage

$CheckoutFields = new CheckoutFields();
$CheckoutFields->deregister_checkout_field( $field_id );
$field_id(string) (required)
The field ID.

CheckoutFields::deregister_checkout_field() code WC 9.7.1

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