Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Does anyone know if it is possible to do something like this to allow the filter Vendor label to change based on the collection / sub > sub collection hierarchy ? Obviously that would be based on the established Menu and linklist " collection- " function I have in place for the menu handles.
I feel like there should be an easier way to do this !
https://water-street-gallery.myshopify.com/collections/art
Pass = wsg
{% comment %}Start of the vendor filter block with dynamic vendor label and filtering{% endcomment %} {% elsif block.type == 'filter_by_vendor' %} <summary> <h4 class="sidebar-block__heading"> {% assign collection_handle = collection.handle %} {% assign vendor_label = 'Artist & Maker' %} <!-- Default Label --> {% assign main_menu = linklists['main-menu'] %} <!-- Assuming 'main-menu' contains your collection hierarchy --> {% for link in main_menu.links %} {% if link.object %} {% if link.object.handle == collection_handle %} {% assign vendor_label = 'Artist' %} <!-- Direct match with top-level collection --> {% elsif link.object.handle contains 'collection-' %} {% assign sub_collection_handle = link.object.handle | remove: 'collection-' %} {% if sub_collection_handle == collection_handle %} {% assign vendor_label = 'Artist' %} <!-- Adjust based on sub-collection logic --> {% endif %} {% endif %} {% endif %} {% endfor %} {{ vendor_label }} <span class="right icon-down-arrow sidebar-block-toggle-icon"></span> </h4> </summary> <ul class="toggle_list"> {% assign collection_products = collections[collection.handle].products %} {% assign filtered_vendors = collection_products | map: 'vendor' | uniq %} {% for vendor in filtered_vendors %} <li class="{% if vendor == collection.title %}active{% endif %} data-active-legacy-filter"> <a href="{{ shop.url }}/collections/{{ collection.handle }}?vendor={{ vendor | handleize }}">{{ vendor }}</a> </li> {% endfor %} </ul>
Thanks to everyone who participated in our AMA with 2H Media: Marketing Your Shopify St...
By Jacqui Sep 6, 2024The Hydrogen Visual Editor is now available to merchants in Shopify Editions | Summer '...
By JasonH Sep 2, 2024Note: Customizing your CSS requires some familiarity with CSS and HTML. Before you cust...
By JasonH Aug 12, 2024