Restrict products by billing email addresses at checkout – WooCommerce

$75.00
Quick Demo

This PHP code for WooCommerce users enables the storeowner to restrict the sale of specific products to a customers billing email address.

The code includes :

  • A text field added to the WooCommerce > Settings page to added a comma separated list of product ids you want restricted.
  • A custom input field added to the WooCommerce > Settings page for pasting comma separated billing email addresses.
  • A function for adding an error notice on the checkout page when the customers billing email addresses doesn’t match the comma separated list.
  • A function to match product ids in cart at checkout against restricted product ids so error messages are only displayed for restricted products.
  • A function which counts the number of matched product ids and changes the product text to products ( plural ) if more than 1 restricted product has been added to the cart.
  • Code to prevent the order being placed when the customers billing email doesn’t match your list.

Custom error message on WooCommerce checkout page restricting purchase of products by billing email addresses

Configuration

In your WordPress Dashboard, go to WooCommerce > Settings > Restricted Emails and add your comma separated list of product ids and billing email addresses for your customers.

Custom text field and text area added to custom WooCommerce Settings page

Installation

Copy & paste the PHP code to the end of your child themes functions file or custom functionality plugin.

Or

Install the zip folder as a new plugin and the configure the settings as seen in the screenshot and demo video.