An account is already registered with your email address. Please log in.
-
Hello,
I let users create an account on checkout,
The problem is, if they come back to make a second purchase with that same email address they will not be able to proceed.
They will be faced by the following error:
An account is already registered with your email address. Please log in.Woocommerce basically tries to create an account and then of course throws this error because the email exists.
To remove this I used the following code. I works well for normal product. But it doesn’t work for woo subscriptions and woo memberships. The moment I activate any of these 2 plugins the following code stops working
// Create user if one does not exist function tn_checkout_create_acct( $post_data ) { $user = get_user_by( 'email', $post_data['billing_email'] ); if ( $user ) { $post_data['createaccount'] = 0; } else { $post_data['createaccount'] = 1; } return $post_data; } add_filter('woocommerce_checkout_posted_data', 'tn_checkout_create_acct'); // Attach order to existing account if user not logged in function tn_checkout_set_customer_id( $current_user_id ) { if ( !$current_user_id ) { $user = get_user_by('email', $_POST['billing_email']); if ( $user ) { $current_user_id = $user->ID; } } return $current_user_id; } add_filter('woocommerce_checkout_customer_id', 'tn_checkout_set_customer_id')
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘An account is already registered with your email address. Please log in.’ is closed to new replies.