collection / collections
Collection picker fields. Use collection for a single collection or collections for a list. Returns the collection object(s) without products.
Need products too?
If you need the collection with its products, use collection_products instead.
Properties
| Property | Type | Required | Description |
|---|---|---|---|
type | "collection" or "collections" | Yes | Single or multiple collections |
label | string | Yes | Label shown in the builder |
default | string or array | No | "" for collection, [] for collections |
Usage
- schema.json
- Template
- Output
{
"primary": {
"type": "collection",
"label": "Collection",
"default": ""
},
"list": {
"type": "collections",
"label": "Collections",
"default": []
}
}
{# Single collection #}
{% if widget.settings.primary %}
<h2>{{ widget.settings.primary.title }}</h2>
<img src="{{ widget.settings.primary.image.fileUrl }}" alt="">
{% endif %}
{# Collections list #}
{% for c in widget.settings.list %}
<a href="/collection/{{ c.handle }}">{{ c.title }}</a>
{% endfor %}
Each collection object includes:
{
"_id": "691f38a8a60232b8a1049823",
"title": "New Arrivals",
"slug": "new-arrivals",
"handle": "new-arrivals",
"image": {
"_id": "67ffd1927f7cd6da2d12bfdd",
"fileUrl": "https://cdn.qumra.cloud/media/..."
},
"description": "",
"operation": "manual",
"productCount": 4
}
Interactive Preview
Interactive Preview
New Arrivals
12 products
Live Output
{
"primary": {
"_id": "691f38a8a60232b8a1049823",
"title": "New Arrivals",
"slug": "new-arrivals",
"handle": "new-arrivals",
"productCount": 12
}
}