Allow customers access to some pages while disallow access to other pages

Topic summary

A user wants to allow customers to access specific pages (landing page, product page, cart, checkout) while showing a “Coming Soon” message on other pages like Q&A sections.

Initial Approach:

  • User attempted adding JavaScript code to theme.liquid to redirect based on URL paths
  • This method has limitations: doesn’t work with JavaScript disabled, content remains visible until redirect executes, and doesn’t prevent non-logged-in customers from viewing content

Recommended Solutions:

  • Customer tags & apps: Use access control/membership apps like Locksmith for more robust content gating
  • Meta-refresh redirects: Preferred over JavaScript redirects as a server-level solution
  • Unpublishing resources: Don’t publish pages/collections/products to the online sales channel that aren’t ready; only link to available pages in menus

Use Case Context:
The user is building a store under time constraints where customers will access a product via QR code on a sample, leading to a landing page. They need a simple way to restrict access to incomplete pages without complex customer status logic.

Server-level redirects (301s) were discussed but noted as unsuitable since they’re meant for permanent URL changes, not conditional access control.

Summarized with AI on November 12. AI used: claude-sonnet-4-5-20250929.

Note that will not work if someone has javascript disabled.

Javascript redirects should be done as a fallback for meta-refresh redirects in a html documents

Additionally that still doesn’t prevent the original content from being rendered and thus viewable until the javascript executes.

In theme.liquid there is a {{ content_for_layout }} that should also have similar logic adjusted for when it’s not the frontpage or other situations mean to be viewable by non-logged in customers.

1 Like