• Resolved mappel

    (@mappel)


    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

Viewing 2 replies - 1 through 2 (of 2 total)
  • Nico

    (@nicolamustone)

    Automattic Happiness Engineer

    Hello there,

    The recent WordPress versions allow logging in both via username and email, so after all, it does not matter what username they set, they can always log in with their email.

    Remi Corson

    (@corsonr)

    Automattic Happiness Engineer

    We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Automatically generate EMAIL as username for customers checking out’ is closed to new replies.