Site icon Hip-Hop Website Design and Development

How do I change the default state label for a country on the WooCommerce checkout page?

I want to modify the WooCommerce checkout page. I want to change the default state label for the UK.

The UK default state label is "county". I want to modify this to "State Code".

I tried the following code but nothing changes.

add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );

function custom_override_checkout_fields( $fields ) {

  unset($fields['billing']['billing_postcode']);
  unset($fields['billing']['billing_state']);
  $fields['billing']['billing_state'] = array(

  'label'=> __('State Code', 'woocommerce'),
  'required'  => true,
  'class'     => array('form-row-wide'),

  );

 return $fields;
}