• Resolved wilfredcy

    (@wilfredcy)


    In the checkout page, How to automatically set the default state when there is is only one state on the country?

    For example, singapore only got one state, so when customer choose “Singapore” as the country, the State field should automatically set to “Singapore” instead of the “Selecte the option…”

    View post on imgur.com

Viewing 4 replies - 1 through 4 (of 4 total)
  • Rynald0s

    (@rynald0s)

    Automattic Happiness Engineer

    Hi @wilfredcy!

    You’ll need to use some code to set the defaults. However, this isn’t conditional so it would set the default state and country prior to your user selecting it. \

    You’d be able set Singapore as your country default and then the default state, and that would be the first thing your customer will see in the checkout.

    That code can be found here https://docs.woocommerce.com/document/change-the-default-state-and-country-on-the-checkout/

    Cheers!

    Thread Starter wilfredcy

    (@wilfredcy)

    Hi,

    I check it out the code you found to me, it work for the default country and state, but my point is when customer choose singapore as their country, the state feild automatic select singapore.

    Hi @wilfredcy ,

    The state field is removed by default when a country without any states is chosen.

    Switching between US and Singapore removes the state
    Link to image: https://d.pr/i/CMzoPT

    There might be something with your theme or another plugin interfering with that, but as WooCommerce works, there’s not a need for a state to be selected at all for Singapore.

    Plugin Support Damianne P (a11n)

    (@drwpcom)

    We haven’t heard from you and I hope that means you’ve resolved the issue.

    I’m going to go ahead and mark this thread as resolved. If you still need help with this issue or have any other questions about the WooCommerce plugin, please start a new thread.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to automatically set the default state when there is is only on’ is closed to new replies.