We need to prevent bad actor who wants to do the frauds. So We need to track their IP or email & blacklist them. Are you running a WooCommerce store? Then check this post.
<?php
/**
* Snippet Name: Blacklist Billing Email on the WooCommerce checkout page.
*/
add_action( 'woocommerce_after_checkout_validation', 'blacklist_billing_email', 999, 2 );
function blacklist_billing_email( $data, $errors ) {
$blacklist = [ 'email1@example.com', 'email2@example.com', 'email3@example.com', ];
if ( in_array( $data['billing_email'], $blacklist ) ) {
$errors->add( 'blacklist', __( 'Sorry, we are unable to process your request.', 'wp-snippets' ) );
}
}
If you need a more advanced version with an admin setting, then please check this.
Leave a Reply