Hi,
Please go to the Cities plugin’s main file and change this line:if ( $state_enabled && in_array( WC()->countries->get_base_country(), get_option( 'wc_csz_countries_codes' ) ) ) {
into this:if ( did_action( 'woocommerce_before_shipping_calculator' ) && ! did_action( 'woocommerce_after_shipping_calculator' ) && $state_enabled && in_array( WC()->countries->get_base_country(), get_option( 'wc_csz_countries_codes' ) ) ) {
if ( in_array( WC()->countries->get_base_country(), get_option( ‘wc_csz_countries_codes’ ) ) ) {
So, this is the line of code, that I changed to the one you provided. Still no different result.
I didn’t find the exact line of code you said to find.
So right now, we haven’t solved this thing.
That’s not the right line, you should be able to locate the exact line of code as here (line 1056).
Do you use the latest plugin version?
/** * Filter the cities by the selected state
*/
public function wc_new_state_dropdown( ) { if ( did_action( ‘woocommerce_before_shipping_calculator’ ) && ! did_action( ‘woocommerce_after_shipping_calculator’ ) && $state_enabled && in_array( WC()->countries->get_base_country(), get_option( ‘wc_csz_countries_codes’ ) ) ) { ?> <script type=”text/javascript”> jQuery( function( $ ) { var country = ‘<?php echo WC()->countries->get_base_country(); ?>’; $( ‘#billing_state’ ).on( ‘select2:open’, function() { billing_filter_states() } ).on( ‘select2:select’, function() { billing_state_update() } ); $( ‘#shipping_state’ ).on( ‘select2:open’, function() { shipping_filter_states() } ).on( ‘select2:select’, function() { shipping_state_update() } ); if ( <?php echo wp_json_encode( is_checkout() ); ?> ) { $( ‘body’ ).on( ‘updated_checkout’, function() { check_country() } ); } else { check_country(); $( ‘#billing_country, #shipping_country’ ).on( ‘select2:select’, function() { check_country() } ); } function check_country() { if ( $( ‘#billing_country’ ).val() == country ) { $( ‘#billing_new_state_field’ ).show(); $( ‘#billing_state’ ).on( ‘select2:open’, function() { billing_filter_states() } ).on( ‘select2:select’, function() { billing_state_update() } ); } else { $( ‘#billing_new_state_field’ ).hide(); } if ( $( ‘#shipping_country’ ).val() == country ) { $( ‘#shipping_new_state_field’ ).show(); $( ‘#shipping_state’ ).on( ‘select2:open’, function() { shipping_filter_states() } ).on( ‘select2:select’, function() { shipping_state_update() } ); } else { $( ‘#shipping_new_state_field’ ).hide(); } } function billing_filter_states() { if ( $( ‘#billing_country’ ).val() == country ) { $( ‘#billing_state’ ).data( ‘select2’ ).dropdown.$search.val( $( ‘#billing_new_state option:selected’ ).text() + ‘ – ‘ ).trigger( ‘input’ ).trigger( ‘query’, { term } ); } } function shipping_filter_states() { if ( $( ‘#shipping_country’ ).val() == country ) { $( ‘#shipping_state’ ).data( ‘select2’ ).dropdown.$search.val( $( ‘#shipping_new_state option:selected’ ).text() + ‘ – ‘ ).trigger( ‘input’ ).trigger( ‘query’, { term } ); } } function billing_state_update() { $( ‘#billing_new_state option’ ).filter( function() { return $( this ).text() == $( ‘#billing_state option:selected’ ).text().split( ‘ – ‘ )[0]; } ).prop( ‘selected’, true ).trigger( ‘change’ ); } function shipping_state_update() { $( ‘#shipping_new_state option’ ).filter( function() { return $( this ).text() == $( ‘#shipping_state option:selected’ ).text().split( ‘ – ‘ )[0]; } ).prop( ‘selected’, true ).trigger( ‘change’ ); } } ); </script> <?php } }
this is the rest of the line from the plugin file.
THANKSSSS. It works now!!
SUPERBBB
