In this article, we will see how to set a default State value for the WooCommerce Checkout Page billing and shipping field(s). I saw this question asked in a WooCommerce Facebook group and like always, took the opportunity to research a solution and learn something new.
The Newsletter for PHP and MySQL Developers
Receive a copy of my ebook, “10 MySQL Tips For Everyone”, absolutely free when you subscribe to the OpenLampTech newsletter.
Note: All examples in this post are part of a development/learning WooCommerce install using the default Storefront theme. PHP code is placed in the child theme’s function.php file. This particular solution works on Astra and OceanWP free themes as well.

I’ve included the code for both the Billing and Shipping State fields (in case needed). In this example, I’m setting the State field dropdown selector to ‘LA’ for Louisiana:
add_filter( 'default_checkout_billing_state', 'custom_woo_default_checkout_billing_shipping_state' );
add_filter( 'default_checkout_shipping_state', 'custom_woo_default_checkout_billing_shipping_state' );
function custom_woo_default_checkout_billing_shipping_state()
{
return 'LA'; //your preferred state abbreviation goes here
}
(Note: The code would need to be altered if for some reason the Shipping and Billing states were not the same.)
Do you need this exact same functionality applied to your own WooCommerce store? Consider hiring me to complete this for you, hassle-free. Visit my services page to learn more.
Credit Resources
The Business Bloomer website has a goldmine of useful information about WooCommerce. I research solutions there all the time and used this article as grounds for a better understanding of this particular coding solution: https://www.businessbloomer.com/woocommerce-set-default-state-checkout-page/
If you see any mistake(s) in the code or know of a better working solution, please share freely in the comments section.
Thank you for reading this post. Please share it with someone else who would enjoy it as well.
Josh Otwell has a passion to grow as a PHP Developer, SQL expert, and technical blogger/writer.
Disclaimer: The majority of examples in this post, are performed in a personal development/learning workstation environment and should not be considered production quality or ready. Your particular goals and needs may vary. Like always, just because you can do something doesn’t mean you should. My opinions are my own.
More ways I can help
- Any of the Web Squadron Mastery Modules can help you with your online web entrepreneurial endeavor(s).
- Get a handle on Google Analytics with this course by the folks over at The Content Technologist.
- Need hosting for your next web application or WordPress site? I highly recommend Hostinger and use them to host my niche bass fishing site. The service is second to none.
- 🔒5 Truths I’ve Come To Realize As a Self-taught Developer
- Mobile wallpapers, digital downloads, photos, development services, and content – all on one Kofi Shop Page. Find your next digital purchase today!
Disclosure: Some of this blog post’s services and product links are affiliate links. At no additional cost to you, should you make a purchase by clicking through one of them, I will receive a commission.
The Newsletter for PHP and MySQL Developers
Receive a copy of my ebook, “10 MySQL Tips For Everyone”, absolutely free when you subscribe to the OpenLampTech newsletter.
📰 Get your brand, product, or service the attention it deserves with affordable classified ad placement in the OpenLampTech newsletter. I appreciate your support!
Thank you for sharing this helpful tutorial on setting a default state field value on the WooCommerce checkout page. It’s always great to learn new ways to customize the user experience and streamline the checkout process.
Speaking of streamlining, have you checked out the Wholesale plugin for WooCommerce? It’s an all-in-one solution for managing wholesale orders, pricing, and customers, and it can save you a ton of time and effort if you sell to businesses or offer bulk discounts. We’ve been using it for our own store and it’s been a game-changer.
If you’re interested, you can learn more about Wholesale Plugin here: https://wholesaleplugin.com/
Thanks again for the great content and keep up the good work!
Hi, Thanks for the comment and compliment. I’ve not yet heard about the mentioned plugin but will check it out at your suggestion. Thanks again for the comments and kind words. I appreciate it 🙏