I’m using woocommerce_checkout_fields to change labels and fields.Below is my code
function custom_override_checkout_fields($fields) {
$fields['billing']['billing_first_name'] = array(
'label' => '',
'placeholder' => _x('First Name*', 'placeholder', 'woocommerce'),
'required' => true,
'class' => array('checkout-billing-first-name')
);
$fields['billing']['billing_last_name'] = array(
'label' => '',
'placeholder' => _x('last Name*', 'placeholder', 'woocommerce'),
'required' => true,
'class' => array('checkout-billing-last-name')
);
$fields['billing']['billing_company'] = array(
'label' => '',
'placeholder' => _x('Company Name', 'placeholder', 'woocommerce'),
'required' => false,
'class' => array('checkout-billing-company')
);
$fields['billing']['billing_address_1'] = array(
'label' => '',
'placeholder' => _x('Address(Line 1)*', 'placeholder', 'woocommerce'),
'required' => true,
'class' => array('checkout-billing-addressL1')
);
$fields['billing']['billing_address_2'] = array(
'label' => '',
'placeholder' => _x('Address(Line 2)*', 'placeholder', 'woocommerce'),
'required' => false,
'class' => array('checkout-billing-addressL2')
);
return $fields;
}
add_filter('woocommerce_checkout_fields', 'custom_override_checkout_fields');
Everything works fine but placeholder for billing address 1 and billing address 2 is changing for only
in loading i.e after page is loaded default placeholder are shown.
Try use filter woocommerce_default_address_fields.
For example:
First add the below filter to prevent replace placeholder from JS.
Then use the below filter
You can also change the default placeholders: