Shopify themes, liquid, logos, and UX
I've been using this guide (How to create a private collection for tagged customers – Sunbowl (sunbowlsystems.com) ) to set up a private collection available only to customers who are logged in and tagged 'laybuy' in my online store.
I've used the following code:
{% if customer.tags contains ‘laybuy’ %}
{% section 'collection.laybuys' %}
{% else %}
{{ pages.no-access.content }}
{% endif %}
I'm now at the testing stage, and I can't access the private collection. I think there may be an issue with the second line of coding.
Can someone please advise?
Shelley
The issue with your code might be due to the use of curly quotes instead of straight quotes in the condition. Replace the curly quotes (‘’
) around the tag value 'laybuy' with straight quotes (''
). Here's the corrected code:
{% if customer.tags contains 'laybuy' %}
{% section 'collection.laybuys' %}
{% else %}
{{ pages.no-access.content }}
{% endif %}
Make sure to update the code with straight quotes and then test it again. This should properly check if the customer is tagged with 'laybuy' and display the private collection if the condition is met. Otherwise, it will display the content from the no-access
page.
User | RANK |
---|---|
155 | |
127 | |
80 | |
73 | |
69 |
Explore the 30-30-30 rule, a dynamic social media strategy for new businesses. Learn how t...
By Trevor Sep 20, 2023Discover how to leverage the often overlooked footer of your ecommerce site to gain custom...
By Skye Sep 15, 2023In this blog, we’ll be shining a light on Shopify Partners, Experts, and Affiliates. Who a...
By Imogen Sep 13, 2023