Skip to content

Instantly share code, notes, and snippets.

@o-nkar
Created July 7, 2022 12:45
Show Gist options
  • Save o-nkar/56676c2e4dfe6d12173afaa7c5fb069b to your computer and use it in GitHub Desktop.
Save o-nkar/56676c2e4dfe6d12173afaa7c5fb069b to your computer and use it in GitHub Desktop.
{% for collection in collections %}
{% if collection.title == "OMBRONE COLLECTION" %}
<a href="{{collection.url}}">
<div class="cm_colec_title"><span>{{collection.title}}</span></div>
</a>
{% assign products = collection['collection_handle'].products %}
{% for product in products %}
{{ product.image | img_url:'master' | img_tag }}
{% endfor %}
{% endif %}
{% endfor %}
@mbkadoglu
Copy link

Hello, i would like to thank you so much for you time. I'm still having a problem.

{% assign products = collection['collection_handle'].products %}
For the " ['collection_handle'] " part I'm adding digits of the url. For example collections/400701784308 this is the url of my collection.
So what I'm doing is {% assign products = collection['400701784308'].products %} putting those digits in there. What am i doin wrong ?

@o-nkar
Copy link
Author

o-nkar commented Jul 7, 2022

simple use
{% for collection in collections %}
{% if collection.title == "OMBRONE COLLECTION" %}

{{collection.title}}


{% assign products = collection.products %}
{% for product in products %}
{{ product.image | img_url:'master' | img_tag }}
{% endfor %}
{% endif %}
{% endfor %}

@mbkadoglu
Copy link

With the previous code you provided products section did show. In my collection there was 9 products and it did create 9 sections but images are not showing
Screen Shot 2022-07-07 at 5 11 23 PM
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment