Skip to content

Instantly share code, notes, and snippets.

@johnmontfx
Last active June 19, 2019 17:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnmontfx/eada143235bda99827729f9a3f862f44 to your computer and use it in GitHub Desktop.
Save johnmontfx/eada143235bda99827729f9a3f862f44 to your computer and use it in GitHub Desktop.
add_filter( 'woocommerce_default_address_fields' , 'fx_free', 99999 );
function fx_free( $fields ) {
$fields['address_1']['required'] = false;
$fields['address_2']['required'] = false;
$fields['city']['required'] = false;
$fields['state']['required'] = false;
$fields['postcode']['required'] = false;
return $fields;
}
# These seem to stick as the array $fields shows the following for billing_states
# and the required is gone from the checkout page :
[billing_state] => Array
(
[type] => state
[label] => State
[required] =>
[class] => Array
(
[0] => form-row-wide
[1] => address-field
)
[validate] => Array
(
[0] => state
)
[autocomplete] => address-level1
[priority] => 80
[country_field] => billing_country
[country] => AU
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment