Skip to content

Age gate

A full-screen dialog asking the visitor to confirm they’re old enough, with no way past it except answering. Off by default.

SettingTypeDefaultWhat it does
EnabledCheckboxOffTurns the gate on
Remember forRange30How long an answer is remembered on that device
VersionText1Change this to ask everyone again
LogoImage(empty)Falls back to the brand wordmark
HeadingInline rich textAre you old enough?
TextTextLegal-age line
Confirm labelTextI am old enough
Decline labelTextTake me back
Decline goes toURL(empty)Where someone under age is sent. Defaults to a search engine
NoteText(empty)Small print under the buttons

Unlike the promo popup, this one cannot be dismissed:

  • There is no close button.
  • Escape is cancelled — pressing it does nothing.
  • The backdrop is inert — clicking outside does nothing.

That’s what makes it a gate rather than a suggestion. It also means two things have to be right, or it becomes a trap.

It’s opened by script, never rendered open

Section titled “It’s opened by script, never rendered open”

The dialog starts closed and is opened by a script. If that script never runs — an error, a blocked asset, a browser that can’t — the visitor sees the site instead of a permanent blank page they have no way to answer.

A gate that cannot be answered is worse than no gate.

decline_url is where an under-age visitor is sent. Leave it empty and they go to a search engine. Either way it’s a working destination, never a dead end or a blank page.

Not from a template. An age gate that only covers the homepage is bypassed by any link straight to a product — an ad, a shared URL, a search result. Rendering it from the layout means every page carries it.

It stays fully editable in the theme editor like any other section.

Confirming is remembered by the shopper’s browser, with an expiry date and under a name that includes the Version setting — so changing the version asks everyone again. While the confirmation is still in the future, the gate doesn’t open.

  • remember_days sets how long. 30 days is the default.
  • version is the reset. Bump it from 1 to 2 and every previously-confirmed device is asked again — useful if your legal requirement changes, or if you need to re-verify after a policy update.
  • A real <dialog> opened with showModal(), so the browser supplies the focus trap and the top layer.
  • aria-labelledby points at the heading.
  • Focus is moved to the confirm button when it opens, so a keyboard user can answer with one keypress.
  • Page scroll is locked while it’s open.
  • The decline control is a real link, so it’s reachable by keyboard and announced as a navigation.