In a previous post, I showed you how to remove billing fields in WooCommerce, without using a plugin.
In this post, I’ll show you have to make billing and shipping fields optional in WooCommerce’s checkout page since it doesn’t have this feature by default.
And again, I’m not going to use a plugin. There’s no need of using a plugin if you can do it manually, at least not for this.
The fewer plugins you have, the better! That’s what I always say.
Make billing and shipping fields optional
First, you’ll have to access your WordPress website’s files.
Then, you’ll have to find and edit the functions.php
file in your child theme. It’s usually in /public_html/wp-content/themes/YOURTHEMENAME-child/functions.php
.

I strongly recommend having a child theme in place, otherwise, your changes will be lost with the next theme update.
I also recommend backing up the file or the whole website, just to be extra safe.
If you don’t have a child theme, you can use the Code Snippets plugin and add the code there.
Now, let’s say that you want to make the “Company” and “Postcode” fields optional.
Once you’re in the functions.php
file, add the following code at the very bottom or right above the ending tag ?>
(if any).
add_filter( 'woocommerce_default_address_fields' , 'optional_default_address_fields' );
function optional_default_address_fields( $address_fields ) {
$address_fields['company']['required'] = false;
$address_fields['postcode']['required'] = false;
return $address_fields;
}
Save the file.
Here’s how the code looks on my theme’s file:

Those checkout billing and shipping fields should be optional now.
If the changes don’t take place after you refresh the page, clear your site and browser cache!
If you want to make more checkout fields optional, then add more $address_fields
into the code.
Here are all the billing and shipping default fields:
- country
- first_name
- last_name
- company
- address_1
- address_2
- city
- state
- postcode
Let’s say you want to add a couple more fields and make them optional: “City” and “State”.
Your code should look like this:
add_filter( 'woocommerce_default_address_fields' , 'optional_default_address_fields' );
function optional_default_address_fields( $address_fields ) {
$address_fields['company']['required'] = false;
$address_fields['postcode']['required'] = false;
$address_fields['city']['required'] = false;
$address_fields['state']['required'] = false;
return $address_fields;
}

As you can see, the “Company”, “ZIP” (Postcode), “City”, and “State” fields are missing the required mark * (asterisk), which means they are now optional.
It wasn’t that hard, right?
Now you know how to make billing and shipping fields optional in WooCommerce, without adding yet another WordPress plugin!
That’s a wrap
Hope you liked the post and found it comprehensive.
Don’t forget to share it to help out others!
You can also follow ThemeSkills on Twitter and subscribe to the YouTube channel.
If you want to start your own WordPress blog, or need a website for your business, my WordPress services are at your disposal!
Cool tip. thanks!
I’m glad you liked it!
Hey, can’t we make the email address field optional?
You should be able too. Have you tried using
billing_email
like you saw in the above code?That was helpful – although I’m wondering how would I adjust the code to make a field optional only if a specific coupon code was added. For example, I’m wanting to make it so that all billing fields become optional if a specific coupon code has been added…