Skip to content

Instantly share code, notes, and snippets.

@jeherve
Last active September 30, 2021 10:31
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeherve/a07ccf469025d722ad7016f6953146fd to your computer and use it in GitHub Desktop.
Save jeherve/a07ccf469025d722ad7016f6953146fd to your computer and use it in GitHub Desktop.
Remove state field from woocommerce checkout form.
<?php
/**
* Remove state field from woocommerce checkout form.
*
* @see https://github.com/woocommerce/woocommerce/blob/3.1.2/includes/class-wc-countries.php#L629
*
* @param array $fields Array of default address fields.
*/
function jeherve_remove_state_field( $fields ) {
unset( $fields['state'] );
return $fields;
}
add_filter( 'woocommerce_default_address_fields', 'jeherve_remove_state_field' );
@phaser32
Copy link

Thank You so much jeherve

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment