Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hi everyone,
I am currently using the 'Spark' theme. I would like to only show certain products based on customer tags. For example: only show X products if customer tags is 'purchased'. In this example only customers who have made a purchase before should be able to see set products.
I want to create a 'secret' collection that is only visible to the customer who made a purchase. Is it possible to have a collection AND products only visible for certain customers with a specific tag?
Thank you 🙂
Open the theme code editor for the Spark theme and locate the template file responsible for rendering the collection page (typically collection.liquid
).
Inside the template file, find the code that retrieves and displays the products for the collection. You'll need to modify this code to include a condition that checks the customer's tags before displaying the products.
Within the code that loops through the products, add a conditional statement to check if the customer has the required tag. You can use the customer.tags
object to access the customer's tags.
If the customer has the required tag, display the product; otherwise, skip it.
Here's a sample code snippet that demonstrates the conditional display based on customer tags:
{% for product in collection.products %}
{% if customer.tags contains 'purchased' %}
<!-- Code to display the product -->
<h3>{{ product.title }}</h3>
<p>{{ product.description }}</p>
<!-- Add any other product details as needed -->
{% endif %}
{% endfor %}
Hello @colinrw
You can follow @NomtechSolution suggestion
or try the app
https://apps.shopify.com/required-login-for-customersv
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025