There is a way to use the if function in the liquid code to achieve a restricted page for specific tagged customers.
But the collection in dawn theme is running on Json.
I tried to implement the collection liquid code template with the if function, the if works fine but the collection content doesn’t display correctly.
The JSON template file only supports JSON code, so you can’t add liquid code. Can you describe more about the code, I will help you to check and add it.
Because with adding code at collection.json file you can add code at main-collection-product-grid.liquid file it will work the same.
The JSON template is the Dawn collection default which looks something like:
{“sections”: {“product-grid”: {
“type”: “main-collection-product-grid”
The following are the liquid code I found for a VIP-tagged customer only collection:
{% if customer.tags contains ‘vip’ %}
{% section ‘collection’ %}
{% else %}
{{ pages.no-access.content }}
{% endif %}
I can’t use liquid in JSON so I tried to use the sample collection liquid code here.
As a result, the if function works perfectly but the collection doesn’t display correctly.
Thank you so so much for the detailed explanations!
But if I want to create one or two special collections that are VIP tagged instead of all collection being restricted, what approach I might have?