You are currently viewing Hide state/country field in the checkout form in Woocommerce| 5 easy steps to fix

Hide state/country field in the checkout form in Woocommerce| 5 easy steps to fix

To hide state/country field in the checkout form in WooCommerce, you can use the following steps:

  1. Install and activate the “Code Snippets” plugin. This plugin allows you to add custom code snippets to your site without modifying the theme files.
  2. Go to Snippets > Add New in your WordPress dashboard.
  3. Add a title for your snippet, such as “Hide state field in checkout form”.
  4. In the “Code” field, add the following code snippet:

Snippets to Hide state/country field in the checkout form in Woocommerce

add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );

function custom_override_checkout_fields( $fields ) {
     unset($fields['billing']['billing_state']);
     return $fields;
}

Click the “Save Changes and Activate” button to add the snippet to your site.

Note that these code snippets will only work if the “Code Snippets” plugin is installed and activated. If you’re facing error with this script then, feel free to contact us.

Join us on Facebook

Leave a Reply