0

On my WooCommerce checkout page, the County field is required, but it gets autofilled by Woo with a random value and some clients forget to put their own county.

enter image description here

How can i edit that checkout field to a have a placeholder or a first value that says Choose your option like in the picture below. And if possible to warn the customer and remind them to pick something if they forget and checkout with that first value.

enter image description here

I played with some code in function.php in the child theme, with woo filters but got no luck. I use woodmart premium theme if that helps.

Catalin
  • 81
  • 7
  • Its my third time posting this question. I dont know how else to ask it. I hope its more clear now. – Catalin Mar 15 '21 at 08:06

1 Answers1

1

You could try adding this code to your child theme function.php file.

add_filter( 'default_checkout_billing_state', 'change_default_checkout_state' 
);
add_filter( 'default_checkout_shipping_state', 
'change_default_checkout_state' );

function change_default_checkout_state() {
    return 'Select a county'; 
}

If you want to warn the customer you could try this..

//Hook
add_action('woocommerce_after_checkout_billing_form', 'fields_before_order_details');

//function

function fields_before_order_details(){
echo 'Don't forget to add your county.';
}
JoshieWahWah
  • 111
  • 1
  • 1
  • 7