Showing a collection list filtered by customer tags.

Keymaster
Tourist
5 0 1

Hey there,

I'm trying to create a section within the Simple Shopify theme that filters collections based on customer tags. For example, the customer has the following tags "Foo", "Bar". In turn display a collection list with only "Foo", "Bar".

I duplicated the collection-list.liquid for my base and made the following edits.

<!-- the magic -->
{% if customer.tags.size >0 %}

<div class="collection-grid">
<div class="grid grid--uniform">

{% for tag in customer.tags %} // check customer tags
{% for link in linklists.main-collections.links %} // loop through collection menu
{% if link.title == tag %} // if a link matches customer tag then do

<div class="grid__item {{ grid_item_width }} slide-up-animation animated" {{ block.shopify_attributes }} role="listitem">
{%- assign collection = collection.tags -%} // Here's where I'm stuck, im not sure what to fill out here in order to display the correct collection based on the found tag.
{% include 'collection-grid-item' %}
</div>

{% endif %}
{% endfor %}
{% endfor %}

</div>
</div>

{% endif %}

 Any help I could get with this would be greatly appreciated.

Thanks

Reply 1 (1)

Keymaster
Tourist
5 0 1

I was able to solve this issue, using the following. Stack Overflow Question.