0

I added 3 States (they're regions, in fact) using this snippet (in functions.php file):

/**
 * Adds States
 */
add_filter( 'woocommerce_states', 'custom_woocommerce_states' );

function custom_woocommerce_states( $states ) {

  $states['UY'] = array(
    'UY1' => 'La Barra', 
    'UY2' => 'Punta del Este',
    'UY3' => 'Maldonado'
  );

  return $states;
}

And I added a couple of shipping methods for each new 'State'.

enter image description here

The problem is when selecting the shipping address on the checkout, it doesn't show the corresponding shipping methods available. E.g. 'Maldonado' It only shows the correct shipping methods if I enter 'UY3'

I tried changing UY3 for Maldonado too, like this:

$states['UY'] = array(
    'La Barra' => 'La Barra', 
    'Punta del Este' => 'Punta del Este',
    'Maldonado' => 'Maldonado'

but it doesn't work either. I assume that the 2 characters country code is required.

How can I make it work so the customers could insert the State name for the shipping methods to show?

Notes:

  • WordPress 5.3.2
  • WooCommerce 4.0.1
1

go to Woocommerce -> Settings -> Shipping -> Shipping options and change the Shipping destination options enter image description here

| improve this answer | |
  • 1
    It was that easy!! Thank you very much! – Damon Hill Mar 25 at 16:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.