toggleCityField( e ) {
    let $wrapper = e.currentTarget.closest( '.woocommerce-billing-fields, .woocommerce-shipping-fields' );
    let $ogCityField = $wrapper.querySelector( '#billing_city_field, #shipping_city_field' );

    // the custom dropdown
    let $citiesField = $wrapper.querySelector( '#_billing_city_field, #_shipping_city_field' );
    let $districtsField = $wrapper.querySelector( '#_billing_district_field, #_shipping_district_field' );

    // If country is ID, hide the original City field
    if( e.currentTarget.value == 'ID' ) { 
      $ogCityField.classList.add( 'wcis-form-row-hidden' );

      $citiesField && $citiesField.classList.remove( 'wcis-form-row-hidden' );
      $districtsField && $districtsField.classList.remove( 'wcis-form-row-hidden' );
    }
    // Else, hide the dropdown and show the original field
    else {
      $ogCityField.classList.remove( 'wcis-form-row-hidden' );

      $citiesField && $citiesField.classList.add( 'wcis-form-row-hidden' );
      $districtsField && $districtsField.classList.add( 'wcis-form-row-hidden' );
    }
  }
/**
   * Show or Hide the original City field depending on the Country selected 
   */
Show or Hide the original City field depending on the Country selected
Show or Hide the original City field depending on the Country selected
toggleCityField( e ) {
    let $wrapper = e.currentTarget.closest( '.woocommerce-billing-fields, .woocommerce-shipping-fields' );
    let $ogCityField = $wrapper.querySelector( '#billing_city_field, #shipping_city_field' );
    let $citiesField = $wrapper.querySelector( '#_billing_city_field, #_shipping_city_field' );
    let $districtsField = $wrapper.querySelector( '#_billing_district_field, #_shipping_district_field' );
    if( e.currentTarget.value == 'ID' ) { 
      $ogCityField.classList.add( 'wcis-form-row-hidden' );
      $citiesField && $citiesField.classList.remove( 'wcis-form-row-hidden' );
      $districtsField && $districtsField.classList.remove( 'wcis-form-row-hidden' );
    }
    else {
      $ogCityField.classList.remove( 'wcis-form-row-hidden' );
      $citiesField && $citiesField.classList.add( 'wcis-form-row-hidden' );
      $districtsField && $districtsField.classList.add( 'wcis-form-row-hidden' );
    }
  }
toggleCityField ( e ) { let $wrapper = e . currentTarget . closest ( '.woocommerce-billing-fields, .woocommerce-shipping-fields' ) ; let $ogCityField = $wrapper . querySelector ( '#billing_city_field, #shipping_city_field' ) ; let $citiesField = $wrapper . querySelector ( '#_billing_city_field, #_shipping_city_field' ) ; let $districtsField = $wrapper . querySelector ( '#_billing_district_field, #_shipping_district_field' ) ; if ( e . currentTarget . value == 'ID' ) { $ogCityField . classList . add ( 'wcis-form-row-hidden' ) ; $citiesField && $citiesField . classList . remove ( 'wcis-form-row-hidden' ) ; $districtsField && $districtsField . classList . remove ( 'wcis-form-row-hidden' ) ; } else { $ogCityField . classList . remove ( 'wcis-form-row-hidden' ) ; $citiesField && $citiesField . classList . add ( 'wcis-form-row-hidden' ) ; $districtsField && $districtsField . classList . add ( 'wcis-form-row-hidden' ) ; } }
Show or Hide the original City field depending on the Country selected
Show or Hide the original City field depending on the Country selected
// the custom dropdown // If country is ID, hide the original City field // Else, hide the dropdown and show the original field