{"title":"List - Liquid Variable","slug":"list-variable-reference","url":"https://support.storeconnect.com/articles/list-variable-reference","url_markdown":"https://support.storeconnect.com/articles/list-variable-reference.md","subtitle":null,"summary":"Access, loop through, and check items in a List collection using index access, key lookup, and iteration attributes like first, last, size, and any?.","type":"Developer_Documentation","video_url":"","keywords":"liquid, variables, List, collection, storeconnect","last_modified":"2026-08-21T07:12:35+0000","body_markdown":"## Description\n\nA List represents a simple collection of items, like an array. You can access items directly by index, look them up by key, or loop through them. List collections load all records at once.\n\n| Property | Value |\n|----------|-------|\n| **Type** | List |\n| **String Representation** | `List[ContentType]` |\n| **Index Access** | Yes (`list[0]`) |\n| **Key Lookup** | Yes (`list[\"key\"]`) |\n\n## Attributes\n\n| Attribute | Type | Description |\n|-----------|------|-------------|\n| `any?` | Boolean | Returns `true` if the List contains at least one item |\n| `first` | Object | Returns the first item in the List |\n| `last` | Object | Returns the last item in the List |\n| `size` | Number | Returns the number of items in the List |\n| `[]` | Object | Access items by integer index (e.g. `list[0]`) or by key (e.g. `list[\"slug\"]`) |\n| `each` | Iterator | Iterate over all items using a `{% for %}` loop |\n\n## Examples\n\n### Looping through a List\n\n\n```liquid\n\n{% for product in collection.products %}\n  \u003cp\u003e{{ product.name }}\u003c/p\u003e\n{% endfor %}\n```\n\n\n### Accessing by index\n\n\n```liquid\n\n{{ collection.products[0].name }}\n{{ collection.products.first.name }}\n{{ collection.products.last.name }}\n```\n\n\n### Accessing by key\n\n\n```liquid\n\n{{ pages[\"about-us\"].name }}\n```\n\n\n### Checking if the list has items\n\n\n```liquid\n\n{% if collection.products.any? %}\n  {{ collection.products.size }} products found\n{% endif %}\n```\n"}