Unable to add a default to woocommerce billing city combo box

38 Views Asked by At

I am having issues with adding a default option "select a city" in woocommerce checkout field.enter image description here

enter image description here

I tried adding a php code like this:

add_filter('woocommerce_checkout_fields', 'set_default_billing_city');

function set_default_billing_city($fields) {
    $fields['billing']['billing_city']['default'] = 'Choose a City';
    return $fields;
}

and tried this php code as well

add_filter( 'woocommerce_checkout_fields', 'bbloomer_set_checkout_field_input_value_default' );
 
function bbloomer_set_checkout_field_input_value_default($fields) {
    $fields['billing']['billing_city']['default'] = 'Choose a city';
    return $fields;
}

But I still get the first option as Abha

Can someone please help me?

0

There are 0 best solutions below