Why you should consider age verification for your store
If you sell age-restricted products, you need to add Age verification to your store to ensure compliance with laws and prevent underage access to potentially harmful goods.
Check the product categories below, and if you see your goods listed -this article should be right for you.
Product categories that strongly recommend the use of age verifications on the store:
- Alcohol and tobacco
- Vapes and e-cigarettes
- Medical and pharmacy
- Cannabis and all related to it
- Weapons and related accessories
- Adult content (pornography and explicit materials)
- Dating services
- Online gambling (gambling services, casino games, sports betting, lotteries, etc.)
So, if you work in these categories, you must carefully assess the age requirements based on jurisdiction and the specific products you sell. You may also need to consult with lawyers to ensure that you run your business properly, maintain legal compliance, protect minors, and uphold responsible business practices.
NOTE: Remember that age verification is not the best way to prevent visitors from browsing your website, as nothing prevents them from lying about their age.
Two Methods on How to Verify Shopify Store Visitor Age
In general, there are two main ways to add age verification to your Shopify store:- Manually create and include an age-check snippet
- Using Pro:Wrning Shopify app
In this article, I will describe the first manual method in detail. To succeed, you'll need some knowledge of HTML, CSS, JavaScript, and Liquid.
Creating and including an age-check snippet manually
- From your Shopify admin, go to the Online Store > Themes.
- Choose a theme you want to edit, and click Actions > Edit code.
- Find and click the Snippets folder to expand its content.
- Below the Snippets folder, click on the Add a new snippet.
- Name your new snippet age-verification, and click Create snippet. Your age-verification snippet will be opened in the code editor.
- In the newly opened age-verification file Paster following code and Save changes
{% assign enter_date_of_birth = false %} {% assign age = 18 %} {% capture adult_header %} Adults only (18+) {% endcapture %} {% capture adult_text %} This website contains age-restricted materials! By entering, you affirm that you are at least 18 years of age or the age of majority in the jurisdiction from which you are accessing the website. {% endcapture %} - In the Layouts folder of the code editor, find and click on your
theme.liquid
file to open it in the editor. - In the online code editor, scroll down until you see the opening
<body>
tag. - After the opening
<body>
tag, paste the following code:{% render 'age-verification' %} - Click Save to save your changes.
How do I change or disable a background image?
To change the background image go to the age-verification.liquid
and find this style code:
Change the URL parameter with your new image address. If you need to apply a solid color instead of an image, just remove all code after the background:
and paster HEX/RGB/RGBA color value.
How do I change the age limit and pop-up content?
In you age-verification.liquid
change the following code to the necessary value
to:
You can also edit all text in the age verification pop-up.
- The heading text is placed after the string:
{% capture adult_header %}
. - And the main body text you'll find after the string:
{% capture adult_text %}
- Buttons text is in the div with the
class="btn-wrapper"
Is it possible to add a birth date picker?
Yes. In you age-verification.liquid
change the variable value from "false" to "true"
to:
Testing age verification functionality in action
Open your storefront to check that all works properly. Once you click the Enter button, you are not prompted about your age again for the next 30 days. To show the age verification again, you need to delete a cookie called ageVerified in the browser's development console on the Application tab.
Adding extended Age Verification with Pro:Wrning Shopify app
If you prefer a no-code solution with much more customizations the Pro:Warnings app is an excellent choice. This app allows you to set up any kind of warnings and verifications, including an age verification pop-up.
Pro:Warnings Notifications
Store alerts, age verification, before checkout warnings, geographic warning, delivery terms, T&C, etc.
Just install the app from the Shopify App Store and set up all the necessary features. You can choose a warning type, change its design, add icons, etc. Basically, the app gives you all the tools to adjust it for any business need and store design.