I am trying to write a shopify section that allows the selection of Collections in the Customise page. I am struggling to understand how to extract the collection information for use in the section's liquid file.
I have read the docs, and tried lot's of different snippets that I have found peppered over the internet, but nothing actually seems to pull the info.
Below is what I currently have
The p tags are me just seeing if there was any output at all, and there is not. The for loop seems to be working as, for the number of collections selected, I get a list item (yay I guess?) - but that's as much magic as I could muster.
<div data-section-id="{{ section.id }}" >
<div class="flex-wrapper ignite-collection">
<ul>
{%- for block in section.blocks -%}
<li>
<a href="{{ collection.url }}">
<img src="{{ collection.image | img_url: '350x' }}" alt="{{collection.title}}">
<h4 class="flex-collection-heading">{{ collection.title }}TEXT HEADING</h4>
</a>
// all of these p tags are left overs from me trying variations of getting info
<p>collection.image {{collections['flex-collection'].image}}</p>
<p>collection.image.url {{ collections['flex-collections'].image.url }}</p>
<p>{{ collections.flex-collection.image.url }}</p>
<p>{{ collections[settings.flex-collection].url }}</p>
<p>collection.url {{settings.flex-collection.url}}</p>
</li>
{%- endfor -%}
</ul>
</div>
</div>
{% schema %}
{
"name": "Ignite Collection list",
"class": "ignite-collection-list-section",
"max_blocks": 6,
"settings": [
{
"type": "select",
"id": "justify-content",
"label": "Justify Content",
"options": [
{"value": "flex-start", "label":"Flex Start"},
{"value": "flex-end", "label":"Flex End"},
{"value": "center", "label":"Center"},
{"value": "space-between","label":"Space Between"},
{"value": "space-around","label":"Space Around"},
{"value": "space-evenly","label":"Space Evenly"}
]
}
],
"presets": [
{
"name": "Ignite Collection list",
"category": "Collections",
"blocks": [
{
"type": "collection"
},
{
"type": "collection"
}
]
}
],
"blocks": [
{
"type": "collection",
"name": "Collection",
"settings": [
{
"id": "flex-collection",
"type": "collection",
"label": "Collection"
}
]
}
]
}
{% endschema %}