-1

I want to customize username field from the woocommerce registration page. My requirement is as per below.

1) User can enter only digits.

2) Length of username must be fixed 10.

3) Customize validation message.

4) Rename title of the username field on registration page.

For login page

1) Rename title of username field.

I searched for that but every time I got that how to add new custom field to the registration form but not getting any thing that how to customize existing field so I have doubt that is that possible to customize username field? If yes then how? I am new to wordpress and woocommerce so please help me

Yes, above things are possible by changes core file of woocommerce which I already did for now but I need to make those changes using functions.php file of child theme so it will not be affected when I update my woocommerce plugin

closed as off-topic by Mark Kaplun, fuxia Apr 29 '17 at 19:05

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

0

Look inside the woocommerce plugin folder. You will find templates for everything. Make a folder called "woocommerce" in your theme folder and copy the folder myaccount to the "woocommerce" folder. The folder contains a php file called form-login.php. You can edit that file for required changes

  • Can I make that woocommerce folder in my child-theme folder? So when I update my main theme, changes can work as it is – DD77 Apr 29 '17 at 8:19
  • I think that shouldn't be a problem – Prasun Jajodia Apr 29 '17 at 11:02
  • Yes it's working but I can only rename the title of the field by editing form-login.php file. How can I restrict that field so user can enter only digits of fixed length? For now I have updated wp-includes/user.php for that restriction and to change validation message I have updated wp-content/plugins/woocommerce/includes/wc-user-functions.php – DD77 May 1 '17 at 5:34
  • I would suggest not editing the plugin files directly as the edits might be replaced during update. As per the restrictions, you can put restrictions on the input field by changing its type to number and adding min and max parameters to it – Prasun Jajodia May 1 '17 at 7:00
  • As for the validation message, I'm sure there's a hook for that. A few minutes in Google or looking at what filters have been applied in the include files will let you figure out the hook – Prasun Jajodia May 1 '17 at 7:01

Not the answer you're looking for? Browse other questions tagged or ask your own question.