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 id | Values | Notes |
|---|---|---|
| product_source | all · collection · search · product | Fills the products drop. |
| product_collection | Collection handle or id | When product_source is collection. Also fills the collection drop. |
| product_search | A search term | When product_source is search. |
| product_limit | 1–24 | Default 8. |
| collection_source | all · handles · manual | Fills the collections drop. manual fetches nothing. |
| collection_handles | Comma-separated handles | When collection_source is handles. Kept in the order you wrote them. |
| collection_limit | 1–24 | Default 6. |
| article_source | none · latest · tag · handles | Fills the articles drop. |
| article_tag | A blog tag | When article_source is tag. |
| article_handles | Comma-separated post slugs | When article_source is handles. |
| article_limit | 1–24 | Default 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.
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.
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.
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
Picking a collection instead of typing a handle
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.Related guides