• Resolved TechMan

    (@techman)


    I want to hide city field from both billing and shipping address. I am using following code but it doesn’t hide shipping although it does hide Postcode and Address2. Why this code is not working for City field?

    add_filter( ‘woocommerce_default_address_fields’ , ‘custom_override_default_address_fields’ );

    function custom_override_default_address_fields( $address_fields ) {
    unset($address_fields[‘postcode’]);
    unset($address_fields[‘address_2’]);
    unset($address_fields[‘city’]);
    $address_fields[‘address_1’][‘label’] = ‘Address’;
    $address_fields[‘state’][‘label’] = ‘City’;

    return $address_fields;
    }

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘How to hide City field’ is closed to new replies.