<?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' ) );
}
}
Kishore Sahoo
Kishore is based in Bangalore, IT Capital of India, specialising in PHP frameworks and CMS where he provides Handcrafted Websites and Applications based on WordPress or Laravel as backend technology & building & deploying powerful Application on the cloud.
Specialties: Problem-Solving, Solution Architectures, Startup Initiative, MVP, WordPress, PHP
Leave a Reply