Created
January 25, 2023 17:23
-
-
Save rynaldos/8daadb490b44a667fc8b9ed30f5fd968 to your computer and use it in GitHub Desktop.
Zimbabwe city extension for checkout page and shipping zones in WooCommerce
This file contains 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
add_filter( 'woocommerce_countries', 'rs_edit_zw_country' ); | |
function rs_edit_zw_country ( $countries ) { | |
$new_countries = array( | |
'ZW' => __( 'Zimbabwe', 'woocommerce' ), | |
); | |
return array_merge( $countries, $new_countries ); | |
} | |
add_filter( 'woocommerce_continents', 'rs_add_new_zw_country_to_continents' ); | |
function rs_add_new_zw_country_to_continents ( $continents ) { | |
$continents['AF']['countries'][] = 'ZW'; | |
return $continents; | |
} | |
add_filter( 'woocommerce_states', 'custom_wc_states_zw' ); | |
function custom_wc_states_zw ( $states ) { | |
$states['ZW'] = array( | |
'Harare' => 'Harare', | |
'Bulawayo' => 'Bulawayo', | |
'Chitungwiza' => 'Chitungwiza', | |
'Mutare' => 'Mutare', | |
'Epworth' => 'Epworth', | |
'Gweru' => 'Gweru', | |
'Kwekwe' => 'Kwekwe', | |
'Kadoma' => 'Kadoma', | |
'Masvingo' => 'Masvingo', | |
'Chinhoyi' => 'Chinhoyi', | |
'Norton' => 'Norton', | |
'Marondera' => 'Marondera', | |
'Ruwa' => 'Ruwa', | |
'Chegutu' => 'Chegutu', | |
'Zvishavane' => 'Zvishavane', | |
'Bindura' => 'Bindura', | |
'Beitbridge' => 'Beitbridge', | |
'Redcliff' => 'Redcliff', | |
'Victoria Falls' => 'Victoria Falls', | |
'Hwange' => 'Hwange', | |
'Rusape' => 'Rusape', | |
'Chiredzi' => 'Chiredzi', | |
'Kariba' => 'Kariba', | |
'Karoi' => 'Karoi', | |
'Chipinge' => 'Chipinge', | |
'Gokwe' => 'Gokwe', | |
'Shurugwi' => 'Shurugwi', | |
); | |
return $states; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment