Is there any way to block disposable emails on Woocommerce registration? I used this plugin with a list of disposable email domains, but it would only block on regular registration - not Woocommerce registration. Any ideas?
Is there any way to block disposable emails on Woocommerce registration? I used this plugin with a list of disposable email domains, but it would only block on regular registration - not Woocommerce registration. Any ideas?
Share Improve this question asked Aug 19, 2018 at 12:00 25676552222567655222 1012 bronze badges 1- github/Ipstenu/ban-hammer/wiki#woocommerce – Sally CJ Commented Aug 19, 2018 at 13:36
2 Answers
Reset to default 1Hi just add this code in your theme functions.php
add_action('init', 'mydomain_plugin_checks');
function mydomain_plugin_checks(){
if ( class_exists('BanHammer') ) {
add_filter('woocommerce_registration_errors', 'woocommerce_banhammer_validation', 10, 3 );
}
}
function woocommerce_banhammer_validation( $validation_errors, $username, $email ) {
if( (new BanHammer)->banhammer_drop( $username, $email, $validation_errors ) )
return new WP_Error( 'registration-error-bad-email', (new BanHammer)->options['message'] );
return $validation_errors;
}
If I am right, are you asking a WordPress plugin which can validate emails from Woocommerce Registration? If so, there is some WordPress plugin that are capable to solve your problem.
Basically those plugins will get the emails inputted from Woocommerce, validate it and return the result back to the form. Some of the plugin will require you to sign up the API key before use.
Currently I am using MailboxValidator Email Validator, which did a great job on protecting my website from disposable email address.