All things Shopify and commerce
Hi All,
Shopify 2.0, dawn, trying to add a option for "All Collections" in the collections list. It only allows to list a specific collection whereas I would like a selection where all collections show up. I assume code has to be added to the collection-list-liquid file but could some help. Something along the lines of: if collection field is left blank, default to "all collections"
Any help is appreciated.
RP
@rpaulpen Hey, thanks for posting here.
can you please use this method:
{% assign selected_collections = section.settings.collections %}
{% if selected_collections.size > 0 %}
<!-- Show selected collections -->
{% for collection in selected_collections %}
<div class="collection-item">
<a href="{{ collection.url }}">
<img src="{{ collection.image | img_url: 'medium' }}" alt="{{ collection.title }}">
<h3>{{ collection.title }}</h3>
</a>
</div>
{% endfor %}
{% else %}
<!-- Show all collections if no specific collection is selected -->
{% for collection in collections %}
<div class="collection-item">
<a href="{{ collection.url }}">
<img src="{{ collection.image | img_url: 'medium' }}" alt="{{ collection.title }}">
<h3>{{ collection.title }}</h3>
</a>
</div>
{% endfor %}
{% endif %}
Thank you for your reply. Not quite what I was thinking. This loads all the collections if left blank wheres what I want is the normal collection list but the one left blank should have a link to the "all collections" rather than a specific collection.
Looking at this closer, the code seems to be in card-collection.liquid. Maybe my description is not clear. All I want in the collection card is to be able to select "All collections" instead of a specific collection. Looking at the attached image, it would take user to same place as the "View All" button does. Assuming the easiest way would be to default to "view all" if left blank.
@rpaulpen does not understand it.
Hey Community! As we jump into 2025, we want to give a big shout-out to all of you wh...
By JasonH Jan 7, 2025Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024