Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Each collection has a custom.parent_collection metafield of type Collection. I need to display subcollections inside a collection that refer to it through a metafield. If people don’t like the collection, then it’s just a title. But now the problem is, I don’t understand how to compare their handle. Perhaps there is a better way to do this.
<div class="business-categories__items"> {% for parent_collection in collections %} {% if parent_collection.metafields.custom.parent_collection == blank %} <div class="category-item"> <div class="category-item__title"> <p>{{ parent_collection.title }}</p> </div> {% for child_collection in collections %} {% if child_collection.metafields.custom.parent_collection == parent_collection.handle %} <div class="category-item__child-title"> <p>{{ child_collection.title }}</p> </div> {% endif %} {% endfor %} </div> {% endif %} {% endfor %} </div>
Find Global Growth Opportunities For Your Business with Shopify AcademyLearn how to exp...
By Shopify Feb 4, 2025Hey Community, happy February! Looking back to January, we kicked off the year with 8....
By JasonH Feb 3, 2025Expand into selling wholesale with Shopify Academy’s learning path, B2B on Shopify: Lau...
By Shopify Jan 28, 2025