Allow users to register on multisite through WooCommerce using the same email address


I’m working on establishing a multisite environment, and have run into the risk of a consumer attempting to register on the sub-site with the same email address they’ve used on the principal web site. I’ve discovered some code here which removes the duplicate email address error and accomplishes this job.

Here is the related code from the answer linked above:

add_filter('wpmu_validate_user_signup', 'skip_email_exist');
operate skip_email_exist($outcome){
    if(isset($outcome['errors']->errors['user_email']) && ($key = array_search(__('Sorry, that email address is already used!'), $outcome['errors']->errors['user_email'])) !== false) {
        if (empty($outcome['errors']->errors['user_email'])) unset($outcome['errors']->errors['user_email']);
    return $outcome;

The difference in my case, is that we’re solely permitting users to register through a WooCommerce buy on the sub-site and, evidently, WooCommerce does not use the same hooks to validate the email address.

Is there an action I can hook into in order that I can carry out the same performance through WooCommerce?

Source link

Leave a Reply