How can I display products based on customer tags in the Dawn theme?

Hello!

I want to show only products to cutstomers if products and customers have the same tag. My theme is Dawn. How can I do that?

2 Likes
  1. Create a new template file: In the “Templates” directory, create a new file called collection.customer-tag.liquid. This file will be used to display products that have tags matching the customer’s tag.

  2. Edit the new template file: Open the collection.customer-tag.liquid file and add the following code:

{% layout none %}
{% paginate collection.products by 12 %}

{% endpaginate %}

Hi @Shoppy_1234

That is doable but you might have to ask the customer to sign in whenever they are viewing the collection. You use the code below as reference

{% if customer %}
  {% if customer.tags contains 'show_customer' %}
   Show the product...
  {% else %}
   Other stuff here
  {% endif %}
{% else %}
Log in to view products...
{% endif %}
1 Like

Thanks. It helped me to find a solution!

1 Like