Automattic\WooCommerce\Blocks\Domain\Services\CheckoutFieldTypes

CheckboxFieldType::prepare_form_field │ public │ WC 1.0

Sets the checked and unchecked values woocommerce_form_field() should submit.

Method of the class: CheckboxFieldType{}

No Hooks.

Returns

array. The updated arguments.

Usage

$CheckboxFieldType = new CheckboxFieldType();
$CheckboxFieldType->prepare_form_field( $form_field ): array;
$form_field(array) (required)
The woocommerce_form_field() arguments built from the field.

CheckboxFieldType::prepare_form_field() code WC 11.2.1

public function prepare_form_field( array $form_field ): array {
	$form_field['checked_value']   = '1';
	$form_field['unchecked_value'] = '0';

	return $form_field;
}