• Resolved ozviewer

    (@ozviewer)


    I need my customer usernames to be their email address. On the create account page the new customer is asked for their email address and password. So far, so good. Let us suppose the customer’s name is J.K. Citizen and his email address is jkcitizen@outlook.com

    On creation of the account the customer will receive an email at his address of jkcitizen@outlook.com which commences:
    “Hi jkcitizen,
    Thanks for creating an account on (website). Your username is jkcitizen.”

    I want the new customer to be told his username is his email: jkcitizen@outlook.com.

    How do I do this?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Use the hook pre_user_login

    function my_same_user_email( $user_login ) {
        if( isset($_POST['billing_email'] ) ) {
            $user_login = $_POST['billing_email'];
        }
    	if( isset($_POST['email'] ) ) {
            $user_login = $_POST['email'];
        }
        return $user_login;
    }
    add_filter( 'pre_user_login' , 'my_same_user_email' );

    or

    add_filter( 'woocommerce_new_customer_data', function( $data ) {
        $data['user_login'] = $data['user_email'];
        return $data;
    } );
    Thread Starter ozviewer

    (@ozviewer)

    Hi crslz. I applied the first suggestion and it worked! Thanks very much.

    Your welcome, please mark this topic as resolved.

    Gr

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Customer username/email confusion’ is closed to new replies.