--- title: "Liquid filters: last" description: Returns the last item in an array. api_name: liquid source_url: html: https://shopify.dev/docs/api/liquid/filters/last md: https://shopify.dev/docs/api/liquid/filters/last.md --- # last ```oobleck array | last ``` Returns the last item in an array. ```liquid {%- assign last_product = collection.products | last -%} {{ last_product.title }} ``` ##### Code ``` {%- assign last_product = collection.products | last -%} {{ last_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 Whole bloodroot ``` ### Dot notation You can use the `last` filter with dot notation when you need to use it inside a tag or object output. ```liquid {{ collection.products.last.title }} ``` ##### Code ``` {{ collection.products.last.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 Whole bloodroot ```