Woocommerce State field dropdown with custom state

I got a custom state and it works although it’s on the bottom of the dropdown list. My client wants it to be alphabetical can’t seem to find a way to reorder this. Here is the code for the custom state:

add_filter( ‘woocommerce_states’, ‘custom_woocommerce_states’ );

function custom_woocommerce_states( $states ) {

$states[‘US’][‘PR’] = ‘Puerto Rico’;

return $states;
}

Read more here:: Woocommerce State field dropdown with custom state

Leave a Reply

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