• Resolved rjcb1990

    (@rjcb1990)


    I noticed Cities Shipping Zones for WooCommerce gets WooCommerce default states names directly from woocommerce/i18n/states.php. This ignores the woocommerce_states filter to change states names. Is there a way to change this to use WC()->countries->get_states() instead?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Condless

    (@condless)

    Hi,
    Please try to redownload the plugin and use the following code snippet (update the state code and the state name):

    add_filter( 'csz_states', 'csz_modify_states_names' );
    function csz_modify_states_names( $states ) {
    	$states_names = [ // State code => state name
    		'AMA'	=> 'New name1',
    		'ANC'	=> 'New name2',
    	];
    	foreach ( $states_names as $state_code => $state ) {
    		if ( isset( $states[ $state_code ] ) ) {
    			 $states[ $state_code ] = $state;
    		}
    	}
    	return $states;
    }
    Thread Starter rjcb1990

    (@rjcb1990)

    Thank you for your quick reply. Its working great now!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Change default state names’ is closed to new replies.