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.
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024