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>