Hello,
I’m trying to customize the checkout State select field.
1) Change field label to “Areas”
2) Change placeholder
3) Make field mandatory
4) Move it right after the country select
I know how to do all those things in the child theme functions.php. Other field’s customization is working fine.
But the problem that in the case with this field my code is not working. Or I would say it is working until JS applied. I think it happens because the script you are using to make this State field nicer, but it makes it not customizable…
What should I do in this situation?
Following is the code for child theme:
// Hook in
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
// Our hooked in function - $fields is passed via the filter!
function custom_override_checkout_fields( $fields ) {
$fields['billing']['billing_state']['label'] = 'Area';
$fields['billing']['billing_state']['required'] = true;
$fields['billing']['billing_state']['priority'] = 20;
unset( $fields['billing']['billing_company'] );
unset( $fields['billing']['billing_postcode'] );
unset( $fields['billing']['billing_city'] );
unset( $fields['order']['order_comments'] );
return $fields;
}