Skip to content

Instantly share code, notes, and snippets.

@dknauss
Last active February 5, 2017 15:21
Show Gist options
  • Select an option

  • Save dknauss/bd5da9f90e3c1d10d7dc1886edf21687 to your computer and use it in GitHub Desktop.

Select an option

Save dknauss/bd5da9f90e3c1d10d7dc1886edf21687 to your computer and use it in GitHub Desktop.
WooCommerce: Define the list of states customers can order from. Source: https://docs.woocommerce.com/document/addmodify-states/
/**
* Code goes in functions.php or a custom plugin. Replace XX with the country code your changing.
*/
add_filter( 'woocommerce_states', 'custom_woocommerce_states' );
function custom_woocommerce_states( $states ) {
$states['XX'] = array(
'XX1' => 'State 1',
'XX2' => 'State 2'
);
return $states;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment