How to make checkout “state” field not required/optional in Woocommerce ?

In this tutorial we’ll learn how to make state field on checkout page optional. First of all add some product(s) in cart and proceed to checkout after doing so. Here you can see that the state field is required.


If i click on place order, this order list will be displayed.


Here you can see the state field error as well, which means that this field is required.

Now add following lines of code at the end of your theme’s functions.php file:

add_filter( 'woocommerce_billing_fields', 'woo_filter_state_billing', 10, 1 );
add_filter( 'woocommerce_shipping_fields', 'woo_filter_state_shipping', 10, 1 );
function woo_filter_state_billing( $address_fields ) {
                $address_fields['billing_state']['required'] = false;
                return $address_fields;
function woo_filter_state_shipping( $address_fields ) {
                $address_fields['shipping_state']['required'] = false;
                return $address_fields;

You can access functions.php file here:


This will make the state field optional.

Now if I click on place order button again you’ll see that state message is no longer in error list.


In this way you can make othere fields optional/required as well.


Editorial Staff

ThemeLocation Provides Wordpress & Woocommerce development & Customization services. Have a Project? Contact To discuss

Leave a Reply

Your email address will not be published. Required fields are marked *