0

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?

1

2 Answers 2

1

Hi 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;
}
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.