--- title: "Liquid filters: first" description: Returns the first item in an array. api_name: liquid source_url: html: https://shopify.dev/docs/api/liquid/filters/first md: https://shopify.dev/docs/api/liquid/filters/first.md --- # first ```oobleck array | first ``` Returns the first item in an array. ```liquid {%- assign first_product = collection.products | first -%} {{ first_product.title }} ``` ##### Code ``` {%- assign first_product = collection.products | first -%} {{ first_product.title }} ``` ##### Data ``` { "collection": { "products": [ { "title": "Blue Mountain Flower" }, { "title": "Charcoal" }, { "title": "Crocodile tears" }, { "title": "Dandelion milk" }, { "title": "Draught of Immortality" }, { "title": "Dried chamomile" }, { "title": "Forest mushroom" }, { "title": "Gift Card" }, { "title": "Glacier ice" }, { "title": "Ground mandrake root" }, { "title": "Health potion" }, { "title": "Invisibility potion" }, { "title": "Komodo dragon scale" }, { "title": "Love Potion" }, { "title": "Mana potion" }, { "title": "Potion beats" }, { "title": "Potion bottle" }, { "title": "Viper venom" }, { "title": "Whole bloodroot" } ] } } ``` ## Output ```html Blue Mountain Flower ``` ### Dot notation You can use the `first` filter with dot notation when you need to use it inside a tag or object output. ```liquid {{ collection.products.first.title }} ``` ##### Code ``` {{ collection.products.first.title }} ``` ##### Data ``` { "collection": { "products": [ { "title": "Blue Mountain Flower" }, { "title": "Charcoal" }, { "title": "Crocodile tears" }, { "title": "Dandelion milk" }, { "title": "Draught of Immortality" }, { "title": "Dried chamomile" }, { "title": "Forest mushroom" }, { "title": "Gift Card" }, { "title": "Glacier ice" }, { "title": "Ground mandrake root" }, { "title": "Health potion" }, { "title": "Invisibility potion" }, { "title": "Komodo dragon scale" }, { "title": "Love Potion" }, { "title": "Mana potion" }, { "title": "Potion beats" }, { "title": "Potion bottle" }, { "title": "Viper venom" }, { "title": "Whole bloodroot" } ] } } ``` ## Output ```html Blue Mountain Flower ```