Automattic\WooCommerce\Blocks\BlockTypes
Checkout::register_settings
Exposes settings exposed by the checkout block.
Method of the class: Checkout{}
No Hooks.
Returns
null. Nothing (null).
Usage
$Checkout = new Checkout(); $Checkout->register_settings();
Checkout::register_settings() Checkout::register settings code WC 10.5.0
public function register_settings() {
register_setting(
'options',
'woocommerce_checkout_phone_field',
array(
'type' => 'object',
'description' => __( 'Controls the display of the phone field in checkout.', 'woocommerce' ),
'label' => __( 'Phone number', 'woocommerce' ),
'show_in_rest' => array(
'name' => 'woocommerce_checkout_phone_field',
'schema' => array(
'type' => 'string',
'enum' => array( 'optional', 'required', 'hidden' ),
),
),
'default' => CartCheckoutUtils::get_phone_field_visibility(),
)
);
register_setting(
'options',
'woocommerce_checkout_company_field',
array(
'type' => 'object',
'description' => __( 'Controls the display of the company field in checkout.', 'woocommerce' ),
'label' => __( 'Company', 'woocommerce' ),
'show_in_rest' => array(
'name' => 'woocommerce_checkout_company_field',
'schema' => array(
'type' => 'string',
'enum' => array( 'optional', 'required', 'hidden' ),
),
),
'default' => CartCheckoutUtils::get_company_field_visibility(),
)
);
register_setting(
'options',
'woocommerce_checkout_address_2_field',
array(
'type' => 'object',
'description' => __( 'Controls the display of the apartment (address_2) field in checkout.', 'woocommerce' ),
'label' => __( 'Address Line 2', 'woocommerce' ),
'show_in_rest' => array(
'name' => 'woocommerce_checkout_address_2_field',
'schema' => array(
'type' => 'string',
'enum' => array( 'optional', 'required', 'hidden' ),
),
),
'default' => CartCheckoutUtils::get_address_2_field_visibility(),
)
);
}