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 the following collections "Foo", "Bar".
I'm not too familiar with liquid so I'm trying to keep things as simple as possible. As such I have duplicated the collection-list.liquid from the 'Simple Theme' for my base and made the following edits to the file.
My Edits
<!-- the magic -->
<div class="collection-grid">
<div class="grid grid--uniform">
{% for tag in customer.tags %} // check customer tags.
{% capture tag_handle %} // capture tag URL handle e.g. /t-shirts in a variable 'tag_handle'
{{ tag | handle }}
{% endcapture %}
{% unless collection.handle contains tag_handle %} // check collection handles against the current tag handle to find a match. If so then do.
<div class="grid__item {{ grid_item_width }} slide-up-animation animated" {{ block.shopify_attributes }} role="listitem">
{% assign collection = collection.handle %} // Assign correct collection. I suspect this to be my stumbling block. See below for reason why.
{% include 'collection-grid-item' %}
</div>
{% endunless %}
{% endfor %}
</div>
</div>
<!-- / the magic -->
With the current code snippet, I do get results equal to the number of customer tags. The problem is that the results are empty, or at least the assigned collection variable is empty.
Any help with this would be greatly appreciated. Thanks in advance.