1

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

ash
  • 79
  • 6

1 Answers1

1

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

Dmitry Leiko
  • 3,970
  • 3
  • 25
  • 42
  • Thanks, but it has changed the phone placeholder in checkout page not register/ my account page – ash Jun 06 '20 at 17:10
  • 2
    @ash By default, there is no phone field in myaccount registration section located on [`myaccount/form-login.php` template file](https://github.com/woocommerce/woocommerce/blob/4.2.0/templates/myaccount/form-login.php) … So this field has been added by you or a third party plugin and you will have to find out yourself how to manage that, as nobody can guess that by magic. – LoicTheAztec Jun 06 '20 at 17:34
  • I havenot add that. Its available in multi vendor version. – ash Jun 06 '20 at 18:07