简体   繁体   中英

Custom phone number placeholder for WooCommerce my account page

I am trying to add a placeholder to phone number in my account page.

add_filter('woocommerce_default_phone_fields', 'override_default_address_my account_fields', 20, 1);
function override_default_address_my_account_fields( $address_fields ) {
     $address_fields['shop-phone']['placeholder'] = '+123456789';
     return $address_fields;
} 

This code has not change the place holder. Can you please help me.

Thanks in advance

You can try use wordpress filter woocommerce_billing_fields :

add_filter(  'woocommerce_billing_fields', 'custom_my_account_fields', 20, 1 );
function custom_my_account_fields( $fields ) {
    $fields['billing_phone']['placeholder'] = '+123456789';
    return $fields;
}

Hope it's help you. I checked It's work

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM