Site access - Add age verification to your online store

Topic summary

A tutorial explains how to add age verification to Shopify stores selling age-restricted products like alcohol or tobacco. The implementation uses a custom snippet that displays a popup requiring visitors to confirm their age or enter their birthdate.

Key Implementation Details:

  • Creates an age-check snippet in the theme’s Snippets folder
  • Sets a cookie (isAnAdult) that prevents re-prompting for 2 weeks
  • Supports both simple yes/no verification and date-of-birth picker options
  • Includes fallback for users with JavaScript disabled

Common Issues Reported:

  • Mobile display problems: Popup appears overly zoomed or as a grey page on mobile devices
  • Age calculation bug: Date-of-birth verification incorrectly requires users to be 1 month older than the specified age threshold
  • Theme editor interference: Age verification popup blocks the Shopify theme customization preview screen and won’t dismiss when clicking Enter/Exit buttons
  • Cookie persistence: Users want options to show the popup on every visit rather than storing the 2-week cookie

Customization Requests:

  • Applying verification to specific collections/pages instead of the entire site
  • Removing background for SEO purposes (transparent overlay)
  • Styling modifications for buttons and text alignment

Important Caveat: This method does not meet FDA regulatory requirements for tobacco/e-cigarette sales and relies on user honesty.

Summarized with AI on October 31. AI used: claude-sonnet-4-5-20250929.

I just added this age verification to our site and it seems to work great, but it seems that something is off in how it calculates age eligibility when using the option to input your birth date.

I just tested it out, and it will only allow you into the online store if you are age 19 plus 1 month (I changed the age to as you mentioned).

As an example, today is Feb 19, 2020 so I assumed that a birthday of Feb 18, 2001 would allow me access and a date of Feb 20, 2001 would not allow me to proceed. When I tested, the latest birthday that I could input that would allow me through the age verification was Jan 19, 2001. Any Birthdates in the first half of Feb 2001 are not being accepted.

Is this something anyone else is having an issue with?

Thanks

1 Like