I'm working on a Woocommerce website and I just came across this problem:
when I go to Account page and I'm asked to create a new account, in the form there isn't the "Username" field. There are just these fields:
- Email (default of Woocommerce)
- Password (default of Woocommerce)
- School number (custom field added with FMA Additional Registration Attributes(Free))
I don't get why I'm not asked to create a username as well. Every time an account is created, I get automatically the first part of the email as username.
Example: If I created an account with this email: firstname.lastname@example.org, I'd get this username: test.test
I don't want Wordpress to create it automatically for me, I'd like to allow the user to create their own username.
I tried to open this file: woocommerce/myaccount/form-login.php
and I edited this line by commenting the IF:
<?php //if ( 'no' === get_option( 'woocommerce_registration_generate_username' ) ) : ?> <p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide"> <label for="reg_username"><?php _e( 'Username', 'woocommerce' ); ?> <span class="required">*</span></label> <input type="text" class="woocommerce-Input woocommerce-Input--text input-text" name="username" id="reg_username" value="<?php echo ( ! empty( $_POST['username'] ) ) ? esc_attr( $_POST['username'] ) : ''; ?>" /> </p> <?php //endif; ?>
After this, the filed was shown but everything remained the same I could fill out the field but it was completelly useless, woocommerce kept using the email to create the account.
I don't know where to look at now to solve this issue.
Is there something else useful that I can tell to make you understand better the problem?