I need help making this page password protected.
Topic summary
A user seeks to password-protect a specific page on their Shopify store (an acne portal page).
Key Challenge:
Shopify’s native password protection only works store-wide, not for individual pages.
Proposed Solution:
A responder provides a custom Liquid code implementation that:
- Checks if a customer is logged in
- Displays page content to authenticated users
- Shows a password form to non-authenticated visitors
- Uses JavaScript to validate the password and set a cookie for persistent access
- Allows access without re-entering the password after refresh
Implementation:
Requires editing the theme’s page.acne-portal.liquid file through Shopify’s code editor (Online Store > Themes > Edit Code).
Status: Solution provided with complete code snippet; awaiting implementation feedback from original poster.
Hello @awakenesti
To password-protect the page, you have a few options:
Option 1: Use Shopify’s Built-in Password Protection
Shopify only allows password protection for the entire store, not individual pages. If you want to restrict access to a specific page, you’ll need custom code.
Option 2: Use Liquid to Restrict Access
You can modify your page.acne-portal.liquid file (or page.liquid if it’s a general template) and add a password form.
Steps:
1.Go to Online Store > Themes.
2.Click Edit Code for your current theme.
3.Open page.acne-portal.liquid (or create a new page template if needed).
4.Add the following Liquid & JavaScript code:
{% if customer %}
{{ page.content }}
{% else %}
This page is password protected. Please enter the password to continue.
Incorrect password. Try again.
{% endif %}
How It Works:
If a customer is logged in, they can access the page.
Otherwise, a password form appears.
Upon correct entry, a cookie is set to grant access.
Refreshing the page allows access without re-entering the password.
Thank you ![]()