A WooCommerce age verification plugin prevents underage people from buying age restricted products on your website. You'll need one if you're selling items such as tobacco, alcohol, 18+ competitions, or adult products. It works by asking customers to verify their age before they can view or buy age restricted products from your WooCommerce store.
In this tutorial, I'll introduce you to 2 popular WooCommerce age verification plugins.
One of these plugins restricts your entire WooCommerce store so that people can only access it after verifying their age. The other plugin lets you restrict specific product categories only, while leaving your other products available to all age groups.
Both plugins will leave your homepage and other main pages (About, Contact, etc.) public. They only provide age verification for your age restricted products. You don't have to lock down your whole website. This lets you create public areas of your website, build your SEO, and get a good search engine ranking (which wouldn't be possible if your whole website was age-restricted. Google's crawlers can't get past age verification!).
I'll provide advice on which WooCommerce age verification plugin best meets your needs. Then I'll show you how to set them up, using a choice of 3 methods. Let's get started!
Are age restriction plugins legal?
Age restriction is a tricky issue in e-commerce because the customer isn't physically present for you to verify their age. Lots of countries simply require website owners to ask customers to confirm their age before allowing them to purchase. WooCommerce age verification plugins work on this basis. It's the customer's responsibility to verify their correct age.
Before we start, I recommend that you check the law for your own country to make sure this is acceptable. If not, then you might need a more comprehensive approach. For example, in extreme circumstances, you might need each customer to provide proof of identify before you will ship age restricted products to them. Method 2 covers a WooCommerce age restriction plugin that can do this, but it does mean more work for you. Fortunately, this isn't normally needed - but you should always check.
Introducing 2 WooCommerce age verification plugins
You should choose an age verification plugin for WooCommerce based on exactly what you need to restrict:
- Method 1 - WooCommerce Private Store with online age verification This simple plugin locks down ALL your WooCommerce content while leaving the rest of your website public. Customers can view your homepage and other main pages, but must verify their age in order to view and buy any products. Use this plugin to add a global age gate which will restrict ALL your products.
- Method 2 - WooCommerce Private Store with individual user accounts Perhaps you still want to age restrict your entire store, but need to manually confirm each user's age before they can start shopping. You can do this by using the WooCommerce Private Store age verification plugin to hide your products from public view, and manually creating individual user accounts for each customer. Logging into their user account will unlock the age restricted store.
- Method 3 - WooCommerce Protected Categories This WordPress plugin is perfect for age restricting specific groups of products within a WooCommerce store, while leaving other products available to everyone. Use it if you only want to restrict some of your products, while leaving others available for all ages.
How do the age verification plugins work?
Methods 1 and 3 are very simple, in that they both password protect parts (or all) of your store. To use them as WooCommerce age verification plugins, you need to set a password for each age that the products are available to. Whenever someone enters their age in the box, the plugin recognises it as a valid password. This tells the plugin that their age is validated and they can view and buy the products within the restricted area.
Method 2 is slightly different because it unlocks the age restricted store for logged in users, while hiding your products from guests.
Next, I'll provide detailed instructions on how to set up each plugin to age restrict your products.
Method 1: How to use WooCommerce Private Store to age restrict your entire shop
This is how to use the WooCommerce Private Store plugin to lock down your entire WooCommerce store. Customers must enter a valid age to unlock the age restricted store.
- First, buy WooCommerce Private Store. Download the plugin and upload it to your site (Plugins > Add New).
- Go to WooCommerce > Settings > Private Store and change these settings:
- License Key - Enter your license key.
- Store Passwords - Add a password for each age that can access the age restricted WooCommerce store. For example, if your store is restricted to people aged 18+, then you need a password for each age over 18. So, you would have a password called 18, one called 19, one called 20, and so on. (I realise this is quite a few passwords, but it only takes a second to add each one, so it won't take you long to create them all.) When someone enters a valid age on the WooCommerce age verification page, the plugin will unlock the store if their age matches one of these passwords.
- Password Expires After - Add a whole number here to specify the number of days that people can continue accessing the store from their browser until they have to re-validate their age. I recommend adding '1' here for added security.
- Login Redirect URL - Normally, a customer will be redirected to whichever page they were trying to access when they had to verify their age. If you prefer, you can enter a specific URL here that they will always be redirected to after validating their age. (E.g. this might be main WooCommerce shop page.)
- Login Form - Finally, you'll see settings for customising the page that people will use to validate their age. In the 'Form Message' field, I recommend adding something self-explanatory that will help people to validate their age. For example, it's helpful to state the format in which people need to enter their name.
- Save your changes.
Now add an age validation page
- In 2 simple steps, you have already age restricted your WooCommerce store so that only people with the correct ages can access it. The final step is to provide a way for them to enter their age and unlock the store. To do this, create a page and add the shortcode
[store_login]. This will create an age verification form, with the text you added on the settings page. Add it to your menu or provide other user-friendly ways for people to find it.
For more information, see the plugin knowledge base.
Note: This applies to your entire shop. If you want to sell some age restricted products and some products that are available to everyone, then you need WooCommerce Password Protected Categories instead. (See next section.)
Method 2: How to use WooCommerce Private Store with individual user accounts
Method 2 is identical to method 1 and uses the same WooCommerce age verification plugin. However, it's more secure because instead of trusting users to enter their own age, you would vet each customer manually and then create a user account for them.
With this method, you'll be using the WooCommerce Private Store plugin in a different way. Each customer must log into their individual user account on your website. This will automatically unlock all the age restricted WooCommerce content (i.e. your main Shop page, products, categories, etc.).
3 simple steps to create an age restricted store
- First, get WooCommerce Private Store. Download the plugin from the link in your confirmation email. Upload it to your website (Plugins > Add New).
- Go to WooCommerce > Settings > Private Store and change the following settings:
- License Key - Enter the license key from your confirmation email. (The plugin only works with a validated license key.)
- Logged In Users - Tick this box. This means that instead of having a separate password for your age restricted WooCommerce store, the store is unlocked whenever someone logs into their user account. An option appears underneath to choose which user roles will have access.
- Finally, create a login page. This should allow customers to log into their main WordPress user account. Either link directly to the main WordPress login page (yourdomain.com/login.php). Or - for a more professional result - create a front end login form using a plugin such as Theme My Login.
And that's it! Your main homepage and other standard WordPress pages will remain public and can appear in search engines etc. All your WooCommerce store content will be hidden from guests, and will immediately appear for logged in users.
Can customers create their own accounts?
Plugins such as Theme My Login add customizable registration forms as well as login forms. Theme My Login also has an option to hold new user registrations for moderation, so that they can only access your hidden store after you've manually validated their age.
If you're not using Theme My Login, then you can add this as a standalone feature with the New User Approve plugin.
Method 3: How to use WooCommerce Password Protected Categories to create an age restricted area within your store
Unlike methods 1 and 2, this WooCommerce age verification plugin lets you create an age restricted area within WooCommerce, while leaving the other parts of your store public. It works by creating one or more private product categories, which can only be viewed after the customer enters a valid age.
First, setup the WooCommerce age verification plugin
- Buy WooCommerce Protected Categories and install the plugin on your WooCommerce website.
- Go to the plugin settings page: WooCommerce > Settings > Products > Protected Categories. Change the following settings:
- License Key - Enter your license key so that the plugin will work.
- Category Visibility - You would normally leave both these boxes unticked for WooCommerce age restricted products. However, it's ok to tick them if you want the age restricted products to appear in the public areas of your site. If you do this, then when someone clicks on one, they will be asked to verify their age before they can add to cart or access the single product page.
- Password Expires After - Add a whole number to set the number of days that each person can continue accessing the age restricted store before having to re-validate their age. I recommend adding '1' here for extra security.
- Client Login Page (optional) - If you like, you can select a page here which will automatically contain an age verification form form. This is optional because you can link directly to your age restricted category page or products, and people will also see the age validation form there.
- Password Form - This section customises the login page where people enter their age to unlock the protected products. Adapt the Form Heading, Form Heading, Password Label and Button Text to an age verification form. (See the below screenshot for an example).
Now create a WooCommerce age verification category
- Next, go to Products > Categories and either create a new category, or edit an existing one. You'll see a 'Visibility' section with a 'Password protected' option. Tick this.
- Instead of just adding 1 password, add lots of passwords - one for each age over 18. So, you would have a password called 18, one called 19, one called 20, and so on. As with method 1, I realise this is quite a lot of passwords. However, it only takes you a second to add each one, you can create them all within a couple of minutes.
- Finally, you need to add links to your age restricted products. If you selected a Login Page on the plugin settings page, then you can link to this from your menu etc. You can also link directly to the age restricted category, if you have ticked the appropriate box on the settings page. Either way, customers will have to verify their age before they can view and buy the restricted products.
What about navigation for my age restricted store?
If parts or all of your WooCommerce store are hidden from underage visitors, then the navigation needs to reflect this. For example, you might want to include menu links to all your product categories once people have verified their age, while hiding these links from everyone else.
Happily, both the WooCommerce Private Store and WooCommerce Protected Categories plugins will automatically do this for you. If you add links to WooCommerce content to your main navigation menu, then these will only be visible to people who have verified their age. You don't have to bother creating different menus for different types of user, as the dynamic links happen automatically.
How to display products to everyone, but require age verification to purchase
Finally, I'll give you a tip that lots of age restricted WooCommerce stores have asked us about.
If you want everyone to be able to browse your store, but only people over 18 or 21 can make a purchase, then you need to use WooCommerce Protected Categories (i.e. method 3 of this tutorial). When you set it up, tick the 'Category visibility' boxes on the plugin settings page:
When you do this, your age restricted products will appear on the main WooCommerce shop page, search results and widgets. When someone clicks on a product, they must login or enter the password (depending on how you've chosen to set up the age restriction) before they can access the single product page or add to cart.
You can use WooCommerce Protected Categories to make your entire store private, as well as hiding specific categories only. To put all your products behind the age gate, simply put them all in age restricted categories.
Which WooCommerce age verification plugin will you use?
In this tutorial, I've taught you how to set up 2 WooCommerce age verification plugins, using 3 different methods. These are designed to suit different types of WooCommerce store, so I hope you find one that works for you.
I'd love to hear how you get on with your age restricted WooCommerce store. Please add your comments below!