List of countries and their states in wordpress

Where is the list of countries and states located in wordpress?
When you select United States on a checkout form the “state” field immediately changes to contain the list of states. I would like to imitate this behavior for other countries. For example when selecting Honduras, you will get the list of states of that country.

Is there an XML file, php file or Database table where WordPress access this information? that way it could be editable to be able to add the states without having to add a plugin or write extra code.

Read More

I know you can access the list from the code with WC()->countries->get_states how ever where is it obtaining it from?

Related posts

Leave a Reply

1 comment

  1. There is a folder called i18n and in that folder there is another folder called states, which contains a list of files. Add your file there as HN.php with a list of the states you want shown e.g.:

    <?php
    /**
     * Honduras
     *
     * @author      WooThemes
     * @category    i18n
     * @package     WooCommerce/i18n
     * @version     2.0.0
     */
    global $states;
    
    $states['HN'] = array(
    'AA' => __( 'Some state', 'woocommerce' ),
    );