Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hello, I have a fitness product and want to make 2 pages members only - workouts and a guide on how to use the product. I need these pages to be members only to collect user information. I don't want to use locksmith as a $12 subscription is out of my budget, these costs add up quickly. I've looked online and chatgtp to make liquid code but nothing seems to work. How would I go about doing this?
Hi @dominikasp
By members, do you mean logged in users only and want to show products ( workouts & guide on how to use the products) for logged in users only?
If that is the case, then you can use either use customer tags or check if the current user is already a customer.
i.e. Either create a tag 'reg_user' for registered users and check if the customer tags contains tag 'reg_user' or simply check {% if customer%}
Hope this guides you.
Thanks,
Sajat
-------------------------
Just a small favor to ask. If this solves your problem, please do not forget to mark it as solution.
Hi Sajat, thank you for taking the time to answer.
By members I mean people who have created an account. So those who have not signed up will see a signup screen when clicking those pages. And those who do have an account will see the guide or workout plan.
Hi @dominikasp
Please put this code on the top of your main-product.liquid code.
{%- liquid
if product.title == 'Your product title 1'
assign login = true
elsif product.title == 'Your product title 2'
assign login = true
endif
if login
if shop.customer_accounts_enabled
if customer
assign loginPage = false
else
assign loginPage = true
endif
endif
endif
-%}
{% if loginPage %}
<div>Login to view product content.</div>
{% else %}
and near the end, you should find </section>
Please put {% endif %} right after </section>
This should work.
Please let me know if you need any help.
Thanks,
Sajat
---------------------
Just a small favor to ask. Please mark this as Accepted Solution if this helped.
I added the code but nothing changed. I likely didn't implement it correctly but I'm not sure how to. What do I change for "Your product title 1" and two? But also these are not products just static pages. Isn't there a code I can put in into the pages individually that will just make the user have to sign in? Thanks
This is the place where to apply this code correct? and in the other screen shot is where I would place {% endif %} after </section>. So do I have to change the Your Product Titles? and what would I change them too? I tried URL links and just typing out the page name https://drive.google.com/file/d/1cz0m1z_ZJ-8JR2YFBBnWodf8xfT5tfBs/view?usp=sharing, https://drive.google.com/file/d/1fW8QZUMzCq6O8nFaiMccWwREsYeY412S/view?usp=sharing
Hi @dominikasp
This code should go to top of the page.
{%- liquid
if product.title == 'Your product title 1'
assign login = true
elsif product.title == 'Your product title 2'
assign login = true
endif
if login
if shop.customer_accounts_enabled
if customer
assign loginPage = false
else
assign loginPage = true
endif
endif
endif
-%}
{% if loginPage %}
<div>Login to view product content.</div>
{% else %}
and yes, the {% endif %} should go after </section>, like as shown in your screenshot.
As for the product name, you need to add individual product names. You can search for the products that you would like to enable login on and copy/paste the name of those products,
Hope this helps you.
Please DM me your main-product.liquid and your products if you require any further assistance.
Thank you
Sajat
---------------------
Just a small favor to ask. Please mark this as Accepted Solution if this helped.
Hey @dominikasp, need a solution for restricting access to specific products or pages on your Shopify store? Watch this informative video:
Discover how to increase customer engagement on your store with articles from Shopify A...
By Jacqui Apr 23, 2025Hey Community 👋 Did you know that March 15th is National Everything You Think Is W...
By JasonH Apr 1, 2025Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025