LiquidProducts, Collections & Posts

Products, Collections & Posts

A template cannot fetch anything itself. To list the store's catalogue, a section declares settings with reserved ids, and the storefront fetches the matching products, collections or posts before the template runs. A section that declares no source costs no fetch.

The source settings

Setting idValuesNotes
product_sourceall · collection · search · productFills the products drop.
product_collectionCollection handle or idWhen product_source is collection. Also fills the collection drop.
product_searchA search termWhen product_source is search.
product_limit1–24Default 8.
collection_sourceall · handles · manualFills the collections drop. manual fetches nothing.
collection_handlesComma-separated handlesWhen collection_source is handles. Kept in the order you wrote them.
collection_limit1–24Default 6.
article_sourcenone · latest · tag · handlesFills the articles drop.
article_tagA blog tagWhen article_source is tag.
article_handlesComma-separated post slugsWhen article_source is handles.
article_limit1–24Default 6.

Declare them as ordinary settings (usually a select and a range) and the merchant controls what the section shows from the settings panel. The values the merchant picks decide the fetch; your template just loops.

Products

Declaring product_source fills the products array.

Product railliquid
{% schema %}
{
"name": "Product rail",
"settings": [
{ "id": "heading", "type": "text", "label": "Heading", "default": "New this week" },
{ "id": "product_source", "type": "select", "label": "Show", "default": "all",
"options": [{ "value": "all", "label": "Latest products" }, { "value": "collection", "label": "A collection" }, { "value": "search", "label": "Search" }] },
{ "id": "product_collection", "type": "text", "label": "Collection handle", "default": "" },
{ "id": "product_search", "type": "text", "label": "Search term", "default": "" },
{ "id": "product_limit", "type": "range", "label": "How many", "default": 4, "min": 2, "max": 24, "step": 1 }
]
}
{% endschema %}
{%- assign uid = section.id -%}
<style>
.pr-{{ uid }} { padding: 32px 20px; font-family: var(--font-body); color: var(--color-text); }
.pr-{{ uid }}-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(160px, 1fr); gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; }
.pr-{{ uid }}-row a { scroll-snap-align: start; color: inherit; text-decoration: none; }
.pr-{{ uid }}-row img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius); }
</style>
<section class="pr-{{ uid }}">
<h2 style="font-family: var(--font-heading);">{{ section.settings.heading }}</h2>
{%- if products.size > 0 -%}
<div class="pr-{{ uid }}-row">
{%- for item in products -%}
<a href="{{ item.url }}">
<img src="{{ item.featured_image | image_url: 400 }}" alt="{{ item.title | escape }}" loading="lazy" />
<div>{{ item.title }}</div>
<div>{{ item.price | money }}{% if item.on_sale %} <s>{{ item.compare_at_price | money }}</s>{% endif %}</div>
{%- unless item.available %}<small>Sold out</small>{% endunless -%}
</a>
{%- endfor -%}
</div>
{%- else -%}
<p>No products to show here yet.</p>
{%- endif -%}
</section>

One chosen product

A product setting with product_source set to product fetches the product the merchant picked into products. Read it with {% assign featured = products | first %}.

Collections

Declaring collection_source fills the collections array. Handles are kept in the order the merchant wrote them.

Collection tilesliquid
{% schema %}
{
"name": "Collection tiles",
"settings": [
{ "id": "collection_source", "type": "select", "label": "Collections", "default": "all",
"options": [{ "value": "all", "label": "All collections" }, { "value": "handles", "label": "Chosen handles" }] },
{ "id": "collection_handles", "type": "text", "label": "Handles, comma-separated", "default": "" },
{ "id": "collection_limit", "type": "range", "label": "How many", "default": 3, "min": 1, "max": 24, "step": 1 }
]
}
{% endschema %}
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; padding: 24px; font-family: var(--font-body);">
{%- for col in collections -%}
<a href="{{ col.url }}" style="position: relative; display: block; color: #fff; text-decoration: none;">
<img src="{{ col.image | image_url: 600 }}" alt="" loading="lazy" style="width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: var(--radius);" />
<span style="position: absolute; left: 12px; bottom: 10px; font-weight: 700; text-shadow: 0 1px 4px #0008;">
{{ col.title }} · {{ col.products_count }}
</span>
</a>
{%- else -%}
<p>No collections yet.</p>
{%- endfor -%}
</div>

Blog posts

Declaring article_source fills articles. A blog setting named article_handles gives the merchant a post picker, and the posts arrive in the order they chose.

Journalliquid
{% schema %}
{
"name": "From the journal",
"settings": [
{ "id": "article_source", "type": "select", "label": "Posts", "default": "latest",
"options": [{ "value": "latest", "label": "Latest" }, { "value": "tag", "label": "With a tag" }, { "value": "handles", "label": "Chosen posts" }] },
{ "id": "article_tag", "type": "text", "label": "Tag", "default": "" },
{ "id": "article_handles", "type": "blog", "label": "Posts" },
{ "id": "article_limit", "type": "range", "label": "How many", "default": 3, "min": 1, "max": 24, "step": 1 }
]
}
{% endschema %}
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px; padding: 24px; font-family: var(--font-body); color: var(--color-text);">
{%- for post in articles -%}
<article>
<a href="{{ post.url }}"><img src="{{ post.image | image_url: 600 }}" alt="" loading="lazy" style="width: 100%; aspect-ratio: 16/10; object-fit: cover; border-radius: var(--radius);" /></a>
<small style="color: var(--color-text-muted);">
<time datetime="{{ post.published_at }}">{{ post.published_at | date: "%b %d, %Y" }}</time> · {{ post.reading_time }} min read
</small>
<h3 style="font-family: var(--font-heading); margin: 6px 0;"><a href="{{ post.url }}" style="color: inherit;">{{ post.title }}</a></h3>
<p style="margin: 0; color: var(--color-text-muted);">{{ post.excerpt | truncate: 120 }}</p>
</article>
{%- endfor -%}
</div>

Always write an empty state

Guard every list with {% if products.size > 0 %} or a {% for %}…{% else %}. A collection with nothing in it, a search that matches nothing, or a failed fetch must not leave a heading floating over an empty box. A failed fetch renders your empty state, never sample data.

In the editor and the playground

The lists hold a sample catalogue of placeholder products, a sample collection and sample posts, so you can judge the layout before pointing it at anything real. On a store, they hold the merchant's own.

Picking a collection instead of typing a handle

The collection, collection_list and product_list setting types give the merchant a picker and resolve to full objects: section.settings.featured.products. See Schema & settings.

Still stuck? Our team reads every message.

Need help?