I am using woocommerce_checkout_fields
filter for customizing the placeholders in WooCommerce checkout page.
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
function custom_override_checkout_fields( $fields ) {
$fields['billing']['billing_first_name']['placeholder'] = 'Name';
$fields['billing']['billing_last_name']['placeholder'] = 'Surname';
$fields['billing']['billing_email']['placeholder'] = 'Email';
$fields['billing']['billing_company']['placeholder'] = 'Company Name';
$fields['billing']['billing_phone']['placeholder'] = 'Phone';
$fields['billing']['billing_postcode']['placeholder'] = 'Zip Code';
$fields['billing']['billing_city']['placeholder'] = 'City';
$fields['shipping']['shipping_first_name']['placeholder'] = 'Name';
$fields['shipping']['shipping_last_name']['placeholder'] = 'Surname';
$fields['shipping']['shipping_city']['placeholder'] = 'City';
$fields['shipping']['shipping_postcode']['placeholder'] = 'Zip Code';
return $fields;
}
This work fine only for checkout page form.
How to customize ‘placeholders’ in all shipping and billing forms?
Thanks.
If you mean in My account pages for Billing and Shipping form, the only filter hook (that I know) that could do the trick is:
It is located in wc-template-functions.php on line 1734, triggered by
woocommerce_form_field()
function in woocommerce templates undermy_account
subfolder,form-edit-address.php
file (displaying the form fields) .This are the default
$args
you can use to target the changes you want to do inside your filter function:USE:
You could use ‘placeholder’ this way to target each placeholder you need to change:
The placeholders are generally the same for billing and shipping address… So your code will be like: