Cirilla Documentations

  1. Home
  2. Docs
  3. Cirilla Documentations
  4. Advanced
  5. Customizing checkout fields using actions and filters

Customizing checkout fields using actions and filters

Example: Set city, state, postcode optional

add_filter( 'woocommerce_get_country_locale_base', 'custom_woocommerce_get_country_locale_base', 11, 1 );
function custom_woocommerce_get_country_locale_base( $locale ) {
	return array(
		'state'    => array(
			'required' => false,
			'hidden'   => true,
		),
		'city'     => array(
			'required' => false,
			'hidden'   => true,
		),
		'postcode' => array(
			'required' => false,
			'hidden'   => true,
		),
	);
}

Reference

Was this article helpful to you? Yes No

How can we help?