Created
August 16, 2016 05:03
-
-
Save WooForce/8404eacd63882b5efad32ce4e3ad2370 to your computer and use it in GitHub Desktop.
Adjusting puerto rico as state
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function wf_remove_puerto_rico_country( $country ) { | |
if(array_key_exists('PR', $country)) | |
{ | |
unset($country['PR']); | |
} | |
return $country; | |
} | |
add_filter( 'woocommerce_countries', 'wf_remove_puerto_rico_country', 10, 1 ); | |
function wf_add_puerto_to_us_states( $states ) { | |
$us_states = $states['US']; | |
if(!array_key_exists('PR', $us_states)) | |
{ | |
$us_states['PR'] = 'Puerto Rico'; | |
} | |
asort($us_states); | |
$states['US'] = $us_states; | |
return $states; | |
} | |
add_filter( 'woocommerce_states', 'wf_add_puerto_to_us_states' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment