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.
We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024Thanks to everyone who participated in our AMA with 2H Media: Marketing Your Shopify St...
By Jacqui Sep 6, 2024The Hydrogen Visual Editor is now available to merchants in Shopify Editions | Summer '...
By JasonH Sep 2, 2024