WooCommerce: Limit State Dropdowns to One State Only

This is a workaround to Limit Shipping and Billing to One State Only. In two of my previous posts (Limit Shipping to One State Only and Limit Billing to One State Only) we’ve seen similar functionalities. In this case, let’s imagine we want to avoid that the user selects unwanted states.

Remove Unwanted States from the Dropdowns (including the “shipping calculator”) – WooCommerce

WooCommerce State Dropdowns @ Checkout
WooCommerce State Dropdowns @ Checkout
WooCommerce State Dropdown @ Cart Shipping Calculator
WooCommerce State Dropdown @ Cart Shipping Calculator

Limit State Dropdowns to One State Only – WooCommerce

// Only one state e.g. PA in US

add_filter( 'woocommerce_states', 'bbloomer_custom_woocommerce_states' );

function bbloomer_custom_woocommerce_states( $states ) {
$states['US'] = array(
'PA' => 'Pennsylvania',
return $states;

Where to add custom code?

You should place custom PHP in functions.php and custom CSS in style.css of your child theme: where to place WooCommerce customization?

This code still works, unless you report otherwise. To exclude conflicts, temporarily switch to the Storefront theme, disable all plugins except WooCommerce, and test the snippet again: WooCommerce troubleshooting 101

Related content

  • WooCommerce: Cart and Checkout on the Same Page
    This is your ultimate guide – complete with shortcodes, snippets and workarounds – to completely skip the Cart page and have both cart table and checkout form on the same (Checkout) page. But first… why’d you want to do this? Well, if you sell high ticket products (i.e. on average, you sell no more than […]
  • WooCommerce: Disable Payment Method If Product Category @ Cart
    Today we take a look at the WooCommerce Checkout and specifically at how to disable a payment gateway (e.g. PayPal) if a specific product category is in the Cart. There are two tasks to code in this case: (1) based on all the products in the Cart, calculate the list of product categories in the […]
  • WooCommerce: Add Privacy Policy Checkbox @ Checkout
    Here’s a snippet regarding the checkout page. If you’ve been affected by GDPR, you will know you now need users to give you Privacy Policy consent. Or, you might need customer to acknowledge special shipping requirements for example. So, how do we display an additional tick box on the Checkout page (together with the existing […]
  • WooCommerce: Redirect to Custom Thank you Page
    How can you redirect customers to a beautifully looking, custom, thank you page? Thankfully you can add some PHP code to your functions.php or install a simple plugin and define a redirect to a custom WordPress page (as opposed to the default order-received endpoint). This is a great way for you to add specific up-sells, […]
  • WooCommerce: Disable Payment Gateway by Country
    You might want to disable PayPal for non-local customers or enable a specific gateway for only one country… Either way, this is a very common requirement for all of those who trade internationally. Here’s a simple snippet you can further customize to achieve your objective. Simply pick the payment gateway “slug” you want to disable/enable […]

Rodolfo Melogli

Business Bloomer Founder

Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as an independent WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza. Follow @rmelogli

9 thoughts on “WooCommerce: Limit State Dropdowns to One State Only

  1. Gracias, me ha servido para límitar los estados de envío a Ciudad de México y Estado de México. Gracias¡¡¡¡

  2. Hi,

    I’ve read your limiting shipping, limiting billing, and limiting dropdown posts but still need some help.

    I want to limit shipping to only PA but allow billing from anywhere. I want to see just PA in the shipping dropdown but all the states in the billing dropdown.

    Are you able to help with this?

    Thanks for any advice!

    1. Laurie, thanks for your comment 🙂 I’ve seen you read all my articles about this, but doesn’t this -> https://businessbloomer.com/woocommerce-limit-shipping-one-state limit states for shipping only? Let me know – otherwise I’ll make sure to fix it 🙂

      1. Hi! It limits the state meaning the user will get an error if they try to use a non-permitted state but the state still shows up in the drop down.

        1. Hey Laurie, thanks for your message! Actually, this snippet should only show one state in the dropdown, so you can’t use a non permitted state 🙂 Do you have a screenshot for me, and have you edited the snippet?

          1. Hi!
            That is exactly the problem.

            It limits the states shown in shipping AND billing. I want every single state shown and active in billing and only certain states shown in shipping.

            Is that possible?

            I don’t see a place to attach a screen shot here. It would show that my billing and shipping drop downs both only show limited states.

            Thank you so much for your patience and help on this matter. I know a lot of other people have the same question.

            1. Thank you Laurie for following up 🙂 Yes, you’re right, this snippet of course targets both Billing and Shipping. I did further research yesterday but could not find a “conditional tag” to execute this filter on the shipping section only.

              I also did look on Google and no one has found a solution to this yet. I hope to be the first 🙂 I’ll keep you posted.

            2. Laurie, a little late but we finally found a working solution. Please check this new blog post here: https://businessbloomer.com/woocommerce-allow-shipping-one-state-only/. Hope this helps 🙂

Questions? Feedback? Customization? Leave your comment now!

If you are writing code, please wrap it like so: [php]code_here[/php]. Failure to complying with this, as well as going off topic or not using the English language will result in comment disapproval. You should expect a reply in about 2 weeks - this is a popular blog but I need to get paid work done first. Please consider joining the Business Bloomer Club to get quick WooCommerce support. Thank you!

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