Automatically generate EMAIL as username for customers checking out
-
I’m stream lining the checkout process and like the idea that a customer doesn’t have to fill out the username field during checkout.
Found the ‘automatically generate username’ tick box in the woo settings.
The generated username is something like name.surname
but I want it to always be: the email address!How can I achieve this?
I found a great code on stackoverflow but can someone confirm that this is a good idea and that this is working without any known conflicts?
I already have customers who came up with their own usernames. The code won’t mess with this, for existing customers everything will be fine and the same?
function my_new_customer_username( $username, $email, $new_user_args, $suffix ) {
return $email;
}
add_filter( ‘woocommerce_new_customer_username’, ‘my_new_customer_username’, 10, 4 );Thanks for helping out!
Warm regards
- The topic ‘Automatically generate EMAIL as username for customers checking out’ is closed to new replies.