• Resolved axsu

    (@axsu)


    Hi!

    I need to modify the states list that are shown in the frontend and to do so I’m following this guide: https://docs.woocommerce.com/document/addmodify-states/.

    In the guide they have this code:

      $states['XX'] = array(
        'XX1' => 'State 1', 
        'XX2' => 'State 2'
      );

    What I need to know is if I can write a long term in the state code (XX1), like ‘Barcelona’. It would be like this:

      $states['ES'] = array(
        'Barcelona' => 'Barcelona', 
        'Madrid' => 'Madrid'
      );

    Can this affect the purchase process in any way? Is it necessary to write acronyms?

    Thank you!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi
    No but you can do like this:

    // Only one state e.g. PA in US
     
    add_filter( 'woocommerce_states', 'ahir_custom_woocommerce_states' );
     
    function ahir_custom_woocommerce_states( $states ) {
    $states['US'] = array(
    'PA' => 'Pennsylvania',
    );
    return $states;
    }

    Thanks
    Ahir

    Thread Starter axsu

    (@axsu)

    Hi @hemant-ahir,

    That is just what I asked ??

    'PA' => 'Pennsylvania',

    Is there any problem changing PA to Pennsylvania?

    'Pennsylvania' => 'Pennsylvania',

    Thank you!

    Okay but did you checked aorder Thank you and email etc. does you get that selected state in order details/email etc. if yes then its fine.

    Plugin Support Missy a11n

    (@m155y5)

    Automattic Happiness Engineer

    We haven’t heard back from you in a while, so I’m going to go ahead and mark this thread as resolved. If you have any other questions please feel free to start a new thread.

    Thread Starter axsu

    (@axsu)

    Hi @m155y5

    You resolved the thread but no one from WooCommerce has answered yet.

    Plugin Support Damianne P (a11n)

    (@drwpcom)

    Hi @axsu. For help with development topics, if you don’t receive an answer in the forums, I recommend the following places for help:

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Is possible to write full keywords in the state code?’ is closed to new replies.