WooCommerce – How to Restrict Products by Email Address

Let’s learn how to restrict WooCommerce products by email addresses. For example, you may want to restrict products for users who have a Gmail or a Yahoo email address. You may also enable specific products for specific customers’ email addresses.

Alternatively, you may want to restrict your own business email within your organization, so users with company email aren’t able to place orders; this can happen by mistake, so you can avoid it by restricting your products by email company.

Besides, you can create protected content or blacklist emails by email company or a specific email address.

We’ll do it quickly using the WordPress Conditional Post Restrictions plugin, which allows you to apply all these post types in WordPress:

  • Posts
  • Pages
  • Products
  • Events
  • Downloads
  • Courses
  • Donations
  • Recipes
  • Forums
  • Lessons
  • Files
  • And any other custom post type.

You can download the plugin here:

Download WordPress Conditional Post Restrictions Plugin - or - Read more

Once you install and activate the plugin, you need to follow the steps in this guide to learn how to restrict WooCommerce products by email company. We’ll show you how to restrict individual products, an entire product category, and all your WooCommerce products.

1- How to restrict individual WooCommerce products by email address

First, we’ll show you how to restrict individual WooCommerce products by email addresses. You’ll edit one product at a time; it’s perfect if you only want to restrict a few products. Just follow these simple steps:

  1. Go to Products > All Products in wp-admin.
  2. Open the product you want to edit.

woocommerce products

Here are the values you need to select in order to restrict this product by the email company or address.

restrict products by email address woocommerce

  • Condition 1: Billing email | Contains | @gmail, for example.
    • If you want to ban a specific email address, select this condition: Billing email = user@email.com. Replace with real email address.
    • Click Add ‘Or’ group to add another email address or company.
    • Don’t use and conditions because the restriction won’t work. Use Or conditions.
  • Update the product to save the changes.

This is how you can restrict a specific individual product by email address. Repeat the steps in this section to restrict other products.

2- How to restrict an entire WooCommerce product category by email address

If you don’t want to restrict individual products by email address, you can restrict an entire WooCommerce product category, so all the products within that category will be restricted. You just need to follow these simple steps:

  1. Go to Products > Categories.
  2. Open the category you’ll edit.

woocommerce categories

Once you’ve opened the category you want to edit, you need to select the following values to restrict this category by email company:

  • Enable the conditional restrictions: Yes
  • Apply restrictions to: Category and posts
  • What happens when the conditions are met: Restrict access

restrict categories for email address

Now, select the following conditions:

  • Condition 1: Billing email | Contains | @gmail, for example.
    • If you want to ban a specific email address, select this condition: Billing email = user@email.com. Replace with real email address.
    • Click Add ‘Or’ group to add another email address or company.
    • Don’t use and conditions because the restriction won’t work. Use Or conditions.
  • Update the category to save the changes.

restrict categories for email address

Once you apply these values, you’ll have restricted the entire category, and users with the selected email address or email company will be banned from your products.

3- How to restrict all your WooCommerce products by email address

If you want to definitely ban email addresses or companies from all your products, you need to apply a global condition that applies to all your WooCommerce products. You can easily do this by following these simple steps.

  1. Go to Settings > Post Restrictions.
  2. Click Add Conditions to create a new global condition.

restrict products by email address woocommerce

Now, select these values to restrict all your WooCommerce products by email address:

  • Add new restrictions: Enter the restriction title.
  • Select post types: Products
  • What happens when the restrictions are met: Restrict access
  • Condition 1: Billing email | Contains | @gmail, for example.
    • If you want to ban a specific email address, select this condition: Billing email = user@email.com. Replace with real email address.
    • Click Add ‘Or’ group to add another email address or company.
    • Don’t use and conditions because the restriction won’t work. Use Or conditions.
  • Publish the condition.

restrict products by email address woocommerce

This is how you can easily restrict all your WooCommerce products by email addresses or companies.

What if banned users try to access your products?

You can select what happens when banned users try to access your products. You need to edit the plugin’s global settings by following these simple steps:

  • Go to Settings > Post restrictions.

Once there, you’ll see these fields and options:

  • Enable restrictions: Tick/untick this checkbox to enable/disable the global conditions.
  • Don’t apply restrictions for these user roles: You’ll see a list of user roles for which the conditions won’t be applied. By default, we will not apply restrictions for administrators, editors, and any user with the capability edit_others_posts.
  • What happens when the post is restricted? You have several options to select what happens when the post is restricted:
    • Redirect to URL
    • Remove the content and show a message
    • Show fragment of the content and show message after fragment
  • What happens when a category is restricted? You have several options to select what happens when the post is restricted:
    • Show error 404
    • Show the normal page without posts
    • Show an error message
    • Redirect to another URL
    • Show the content of another page

Once you select the global settings, just save the changes.

Restricting products by email address or company is really easy!

You don’t have to program anything nor hire a professional programmer to apply these conditional restrictions to your products. With a few clicks, you can restrict your products individually, by category, or completely.

You can download the plugin here:

Download WordPress Conditional Post Restrictions Plugin - or - Read more

Close Menu