Skip to content

Instantly share code, notes, and snippets.

@aaliyan111
Forked from Chrisedmo/filter-vendor.liquid
Created October 24, 2018 07:34
Show Gist options
  • Save aaliyan111/07c3919fd97273ee4f9ade6105f63eb0 to your computer and use it in GitHub Desktop.
Save aaliyan111/07c3919fd97273ee4f9ade6105f63eb0 to your computer and use it in GitHub Desktop.
Shopify: Filter by Vendor
<!-- add the vendor as product tag to product then use this code in collection.liquid -->
<!-- if we are on a collection page that is either custom or smart -->
{% if collection.url != blank %}
<h4>Shop by vendor:</h4>
<ul>
{% for product_vendor in collection.all_vendors %}
<li>
{% if current_tags contains product_vendor %}
<a class="active" href="{{ collection.url }}">{{ product_vendor }}</a>
{% else %}
<a href="{{ collection.url }}/{{ product_vendor | handle }}">{{ product_vendor }}</a>
{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment