A merchant successfully locked down a members-only collection using Liquid code that checks for logged-in customers with a ‘vip’ tag. However, individual products remained accessible via direct URL.
Solution Implemented:
The original poster created a second product template (main-product-club.liquid) and wrapped the entire product section in the same if/else conditional logic used for collections. This prevents non-VIP customers from viewing restricted products even with direct links.
Key Technical Points:
Collection templates use Liquid; product templates are JSON but can include Liquid in referenced sections
The code redirects non-VIP users to either login or membership purchase pages
Another user confirmed this approach works for creating completely private collections visible only to tagged vendors
Alternative Approaches Mentioned:
Wrapping product-form renders and content in conditional statements
Tag-based product restrictions for scalability
Using the “Latch” app for automated member-only access without manual template editing
Status: Resolved - the custom product template solution successfully restricts direct product URL access to VIP customers only.
Summarized with AI on October 27.
AI used: claude-sonnet-4-5-20250929.
Creating a Member’s Only Collection and Products. I have the Collection piece of this figured out…but am stuck on the individual product piece. I am able to use the liquid code below to “lock down” a whole collection to a logged in customer with a tag of ‘vip.’ This works very well. However, a non-customer, or customer without the vip tag is still able to view a ‘member’s only’ product directly if they have the correct URL.
I have a ‘members shop here’ button that links to the members only collection, with the above applied as a collection template to that collection. What I am missing is effectively the same functionality but for a product. I noticed that collection templates use liquid, while a custom product template is JSON.
Good idea. I ended up successfully creating a second product template and associate second product section, and wrapped the whole member’s only product (main-product-club.liquid) in the if/else statement above.
I just wanted to say thank you because I have been searching all day for the solution to my problem. Very similar to yours.
I was trying to create a private collection, for only customers who have the ‘vip’ tag. I just grabbed the third line of your code and now I have a completely private collection, that can only be accessed by the Vendors I select for acceptance. And no other visitors to my page can see the products.
I think this code is what you need. Take a look at my page and tell me if this is what you are trying to do. If so I will explain in full detail how to achieve this for yourself.
You’re right that product templates work differently than collection templates. The issue is that individual product pages can still be accessed directly even if the collection is locked down.
Option 1: Product Template Liquid Solution You can create a custom product template that includes the same logic. Even though the product template is JSON, you can still add liquid code to the sections it references. Create a new product template and modify the main product section:
<!-- In your product template section -->
{% if customer %}
{% if customer.tags contains 'vip' %}
<!-- Show normal product content -->
{% render 'product-form' %}
<!-- Rest of your product content -->
{% else %}
<script>
if (confirm('Please join the Karl Bruce Caviar Club to view this product.')) {
window.location.href = '/products/karl-bruce-caviar-club-membership';
} else {
window.location.href = '/pages/karl-bruce-caviar-club';
}
</script>
{% endif %}
{% else %}
<script>
if (confirm('Please login to view this product.')) {
window.location.href = '/account/login';
} else {
window.location.href = '/pages/karl-bruce-caviar-club';
}
</script>
{% endif %}
Option 2: Tag-Based Product Restriction You could also tag your VIP products and check for both customer and product tags to create a more scalable solution.
App Recommendation: Actually, I developed an app called Latch specifically for this type of member-only product access. It automatically handles both collection and individual product restrictions for tagged customers, plus it can upsell memberships right on the locked pages. No template editing needed! Check it out: https://apps.shopify.com/member-lock
The liquid solution above should work for your current setup, but if you’re planning to expand your VIP offerings, having an app handle the logic might save you time and headaches down the road.