I'm working on setting up a multisite environment, and have run into the possibility of a user trying to register on the sub-site with the same email address they've used on the main site. I've found some code here which removes the duplicate email address error and accomplishes this task.
Here is the relevant code from the answer linked above:
add_filter('wpmu_validate_user_signup', 'skip_email_exist');
function skip_email_exist($result){
if(isset($result['errors']->errors['user_email']) && ($key = array_search(__('Sorry, that email address is already used!'), $result['errors']->errors['user_email'])) !== false) {
unset($result['errors']->errors['user_email'][$key]);
if (empty($result['errors']->errors['user_email'])) unset($result['errors']->errors['user_email']);
}
define( 'WP_IMPORTING', 'SKIP_EMAIL_EXIST' );
return $result;
}
The difference in my case, is that we're only allowing users to register through a WooCommerce purchase on the sub-site and, evidently, WooCommerce doesn't use the same hooks to validate the email address.
Is there an action I can hook into so that I can perform the same functionality through WooCommerce?