Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter mfaizansiddiqui

    (@mfaizansiddiqui)

    Please help me to add a City (Karachi), Which is located in Sindh, Pakistan

    Plugin Author Condless

    (@condless)

    Hi,
    You can add this into your theme’s functions.php file:

    add_filter( 'csz_cities', 'csz_remove_woocommerce_states' );
    function csz_remove_woocommerce_states( $states ) {
        if ( isset( $states['PK']['PKSN49'] ) ) {
            for ( $i = 36; $i <= 66; $i++ ) {
                    unset( $states['PK'][ 'PKSN' . $i ] );
            }
            $states['PK']['PKSN49'] = 'KARACHI';
            for ( $i = 1; $i <= 94; $i++ ) {
                    unset( $states['PK'][ 'PKPJ' . $i ] );
            }
            $states['PK']['PKPJ1'] = 'RAWALPINDI';
            $states['PK']['PKPJ2'] = 'SARGODHA';
            $states['PK']['PKPJ3'] = 'FAISALABAD';
            $states['PK']['PKPJ4'] = 'GUJRANWALA';
            $states['PK']['PKPJ5'] = 'LAHORE';
        }
        return $states;
    }
    Thread Starter mfaizansiddiqui

    (@mfaizansiddiqui)

    Thank you for your help, also please let me know why you are adding these states in your code?

    $states[‘PK’][‘PKPJ1’] = ‘RAWALPINDI’;
    $states[‘PK’][‘PKPJ2’] = ‘SARGODHA’;
    $states[‘PK’][‘PKPJ3’] = ‘FAISALABAD’;
    $states[‘PK’][‘PKPJ4’] = ‘GUJRANWALA’;
    $states[‘PK’][‘PKPJ5’] = ‘LAHORE’;`

    Also, are you going to update the plugin which will resolve this issue? if yes, so should I need to remove this filter? Please suggest.

    Thanks again appreciated!

    Plugin Author Condless

    (@condless)

    Some of the states/cities of Pakistan are splitted into smaller municipalities, this code will display those areas with their familiar names.

    If the plugin will be updated regarding this issue you will be notified.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Karachi is absent in Sindh, Pakistan’ is closed to new replies.