{"id":111371,"date":"2019-04-14T17:00:00","date_gmt":"2019-04-14T17:00:00","guid":{"rendered":"https:\/\/avada.io\/blog\/get-item-with-specified-index-in-array\/"},"modified":"2026-04-08T08:15:48","modified_gmt":"2026-04-08T01:15:48","slug":"get-item-with-specified-index-in-array","status":"publish","type":"post","link":"https:\/\/avada.io\/blog\/get-item-with-specified-index-in-array\/","title":{"rendered":"How to Get Item with specified index in Array in Liquid"},"content":{"rendered":"<p>Your online is encountering the inconvenience in showing specific items or product tags which is neither the first one nor the last one in your product page. If you are using <a href=\"https:\/\/avada.io\/blog\/liquid\">Liquid template language<\/a>, you can take a look to view these steps below to help you gather items. The tutorial aims to assist you in <strong>getting the item with specified index in array in liquid<\/strong>.<\/p>\n<p><strong>Table of content<\/strong><\/p>\n<ul>\n<li><a href=\"#what-is-Liquid-template-language\">What is Liquid template language?<\/a><\/li>\n<li><a href=\"#information-about-the-array-filter-and-index-liquid\">Information about the array filter and index liquid?<\/a><\/li>\n<li><a href=\"#how-to-get-the-item-with-specified-index-in-array-in-liquid\">How to get the item with specified index in array in liquid<\/a><\/li>\n<\/ul>\n<h2 id=\"what-is-liquid-template-language\">What is Liquid template language?<\/h2>\n<p><a href=\"https:\/\/avada.io\/blog\/liquid\">The liquid<\/a> is one of the open-source template languages in Shopify. Liquid code is clasified into three different types consisting of objects, tags and filters. The tutorial today focuses on the array filter, one of helpful function of this website language. The liquid is used as the backbone of Shopify to upload dynamic content on the front page.<\/p>\n<h2 id=\"information-about-the-array-filter-and-index-liquid\">Information about the array filter and index liquid?<\/h2>\n<p>In order to create the product array, you star with the capture tag so that you can set a new product list. When assigning value to each element, you separate each value with a singe product using a <code class=\"language-plaintext highlighter-rouge\">|<\/code> and each set of product value with <code class=\"language-plaintext highlighter-rouge\">::<\/code>. The <code class=\"language-plaintext highlighter-rouge\">::<\/code> itself is qualified with a conditional statement. Once the product list is complete, you also use <code class=\"language-plaintext highlighter-rouge\">::<\/code> to create a new varialble<\/p>\n<p>Array filter is a function used to create a new array from a provided array including names or items which meet the demand of the condition set by the argument function. In general, the formation of an array looks like this:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/cdn4.avada.io\/media\/shopify\/XGK95c3.jpg\" alt=\"sample array filter\" \/><\/p>\n<p>The filter feature is used to offer callback function for each character in an array and build a new array that can also give the value back to confirm the true feature of that element. The callback is compatible with three arguments: the value of the element, the index of the element and the array objects being traversed.<\/p>\n<p>In addition, the range of elements demonstrated by the filter is set by the first petition of the callback. If existing elements are changed or eliminated, their value will be passed to the filter hence when filter check these elements, their value is retained.<\/p>\n<p><code class=\"language-plaintext highlighter-rouge\">Index.liquid<\/code> is belonged to the array filter. The index.liquid refers to the homepage of the store. This template is loaded when you visit the root of the store. This template helps to return an item at a specific location in an array.<\/p>\n<div class=\"internal-link-block col-lg-12\">\n<div class=\"internal-link-content-wrapper\">\n<p class=\"h3\">Free 1:1 Shopify consultation &amp; 30-day all-app trial <strong style=\"font-size: 28px\">FREE<\/strong><\/p>\n<p>      <span class=\"internal-link-content-main\"><\/p>\n<ul>\n<li>Shopify Plus Strategy and Consultation<\/li>\n<li>Personalized E-commerce Solutions<\/li>\n<li>Conversion Rate Boosting Techniques<\/li>\n<li>Inventory Management Hacks<\/li>\n<\/ul>\n<p>      <\/span><br \/>\n      <button style=\"margin-left: 22px\" class=\"text-white avada-first-ctabox py-2 px-4 rounded\"><br \/>\n        <a class=\"text-white\" href=\"https:\/\/www.mageplaza.com\/services\/shopify-development-services\/?utm_source=avada_devdocs&amp;utm_medium=banner&amp;utm_campaign=Service-shopify#contact-us\" rel=\"nofollow noopener\" target=\"_blank\">Consult with us now!<\/a><br \/>\n<\/button>\n    <\/div>\n<div class=\"internal-link-banner\">\n      <img decoding=\"async\" src=\"https:\/\/cdn2.avada.io\/media\/resources\/newwomen.webp\" \/>\n    <\/div>\n<\/div>\n<h2 id=\"how-to-get-the-item-with-specified-index-in-array-in-liquid\">How to get the item with specified index in array in liquid<\/h2>\n<p>Here is one simple formula that you can follow. Attention: array numbering begins from zero, the first item in an array will be attached with <code class=\"language-plaintext highlighter-rouge\">[\u00d8]<\/code>. For instance, if you want to show \u201cwomen\u201d in an array, you do these steps:<\/p>\n<p>Input:<\/p>\n<div class=\"language-plaintext highlighter-rouge\">\n<div class=\"highlight\">\n<pre class=\"highlight\"><code>\n&lt;!-- product.tags = \"sale\", \"mens\", \"womens\", \"awesome\" --&gt;\n{{ product.tags[2] }}\n\n<\/code><\/pre>\n<\/div>\n<\/div>\n<p>Output:<\/p>\n<div class=\"language-plaintext highlighter-rouge\">\n<div class=\"highlight\">\n<pre class=\"highlight\"><code>womens\n\n<\/code><\/pre>\n<\/div>\n<\/div>\n<h3 id=\"conclusion\">Conclusion<\/h3>\n<p>In conclusion, getting item wwith specified index in arrat in liquid may make the shopping journey become easier. Buyers will find it more convenient when shopping around because they do not need much time to seek key tags or information.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Your online is encountering the inconvenience in showing specific items or product tags which is neither the first one nor the last one in your product page. If you are using Liquid template language, you can take a look to view these steps below to help you gather items. The tutorial aims to assist you [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[356,383],"tags":[],"class_list":["post-111371","post","type-post","status-publish","format-standard","hentry","category-shopify","category-shopify-devdocs"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Get Item with specified index in Array in Liquid in Shopify<\/title>\n<meta name=\"description\" content=\"Learn to retrieve array items by index in Shopify Liquid with our developer-friendly guide and code examples.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/avada.io\/blog\/get-item-with-specified-index-in-array\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Get Item with specified index in Array in Liquid in Shopify\" \/>\n<meta property=\"og:description\" content=\"Learn to retrieve array items by index in Shopify Liquid with our developer-friendly guide and code examples.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/avada.io\/blog\/get-item-with-specified-index-in-array\/\" \/>\n<meta property=\"og:site_name\" content=\"Avada Commerce\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/avada.io\/\" \/>\n<meta property=\"article:published_time\" content=\"2019-04-14T17:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-04-08T01:15:48+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdn4.avada.io\/media\/shopify\/XGK95c3.jpg\" \/>\n<meta name=\"author\" content=\"Sam\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@avadaio\" \/>\n<meta name=\"twitter:site\" content=\"@avadaio\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sam\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Get Item with specified index in Array in Liquid in Shopify","description":"Learn to retrieve array items by index in Shopify Liquid with our developer-friendly guide and code examples.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/avada.io\/blog\/get-item-with-specified-index-in-array\/","og_locale":"en_US","og_type":"article","og_title":"How to Get Item with specified index in Array in Liquid in Shopify","og_description":"Learn to retrieve array items by index in Shopify Liquid with our developer-friendly guide and code examples.","og_url":"https:\/\/avada.io\/blog\/get-item-with-specified-index-in-array\/","og_site_name":"Avada Commerce","article_publisher":"https:\/\/www.facebook.com\/avada.io\/","article_published_time":"2019-04-14T17:00:00+00:00","article_modified_time":"2026-04-08T01:15:48+00:00","og_image":[{"url":"https:\/\/cdn4.avada.io\/media\/shopify\/XGK95c3.jpg","type":"","width":"","height":""}],"author":"Sam","twitter_card":"summary_large_image","twitter_creator":"@avadaio","twitter_site":"@avadaio","twitter_misc":{"Written by":"Sam","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/avada.io\/blog\/get-item-with-specified-index-in-array\/#article","isPartOf":{"@id":"https:\/\/avada.io\/blog\/get-item-with-specified-index-in-array\/"},"author":{"name":"Sam","@id":"https:\/\/avada.io\/#\/schema\/person\/cc9c647e3ec94d00dc61ae2e653cafb7"},"headline":"How to Get Item with specified index in Array in Liquid","datePublished":"2019-04-14T17:00:00+00:00","dateModified":"2026-04-08T01:15:48+00:00","mainEntityOfPage":{"@id":"https:\/\/avada.io\/blog\/get-item-with-specified-index-in-array\/"},"wordCount":550,"publisher":{"@id":"https:\/\/avada.io\/#organization"},"image":{"@id":"https:\/\/avada.io\/blog\/get-item-with-specified-index-in-array\/#primaryimage"},"thumbnailUrl":"https:\/\/cdn4.avada.io\/media\/shopify\/XGK95c3.jpg","articleSection":["Shopify","Shopify Devdocs"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/avada.io\/blog\/get-item-with-specified-index-in-array\/","url":"https:\/\/avada.io\/blog\/get-item-with-specified-index-in-array\/","name":"How to Get Item with specified index in Array in Liquid in Shopify","isPartOf":{"@id":"https:\/\/avada.io\/#website"},"primaryImageOfPage":{"@id":"https:\/\/avada.io\/blog\/get-item-with-specified-index-in-array\/#primaryimage"},"image":{"@id":"https:\/\/avada.io\/blog\/get-item-with-specified-index-in-array\/#primaryimage"},"thumbnailUrl":"https:\/\/cdn4.avada.io\/media\/shopify\/XGK95c3.jpg","datePublished":"2019-04-14T17:00:00+00:00","dateModified":"2026-04-08T01:15:48+00:00","description":"Learn to retrieve array items by index in Shopify Liquid with our developer-friendly guide and code examples.","breadcrumb":{"@id":"https:\/\/avada.io\/blog\/get-item-with-specified-index-in-array\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/avada.io\/blog\/get-item-with-specified-index-in-array\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/avada.io\/blog\/get-item-with-specified-index-in-array\/#primaryimage","url":"https:\/\/cdn4.avada.io\/media\/shopify\/XGK95c3.jpg","contentUrl":"https:\/\/cdn4.avada.io\/media\/shopify\/XGK95c3.jpg"},{"@type":"BreadcrumbList","@id":"https:\/\/avada.io\/blog\/get-item-with-specified-index-in-array\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/avada.io\/"},{"@type":"ListItem","position":2,"name":"Shopify","item":"https:\/\/avada.io\/category\/shopify"},{"@type":"ListItem","position":3,"name":"Shopify Devdocs","item":"https:\/\/avada.io\/category\/shopify-devdocs\/"},{"@type":"ListItem","position":4,"name":"How to Get Item with specified index in Array in Liquid"}]},{"@type":"WebSite","@id":"https:\/\/avada.io\/#website","url":"https:\/\/avada.io\/","name":"Avada Commerce","description":"Blog","publisher":{"@id":"https:\/\/avada.io\/#organization"},"alternateName":"Avada Commerce","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/avada.io\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/avada.io\/#organization","name":"Avada Commerce","alternateName":"Avada Commerce","url":"https:\/\/avada.io\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/avada.io\/#\/schema\/logo\/image\/","url":"https:\/\/avada.io\/wp-content\/uploads\/2023\/06\/Avada-logo.jpeg","contentUrl":"https:\/\/avada.io\/wp-content\/uploads\/2023\/06\/Avada-logo.jpeg","width":1200,"height":1200,"caption":"Avada Commerce"},"image":{"@id":"https:\/\/avada.io\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/avada.io\/","https:\/\/x.com\/avadaio","https:\/\/www.youtube.com\/@avadaio","https:\/\/www.linkedin.com\/company\/avadacommerce"]},{"@type":"Person","@id":"https:\/\/avada.io\/#\/schema\/person\/cc9c647e3ec94d00dc61ae2e653cafb7","name":"Sam","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/fdce01bbdb8b8eaa162f8ed372062707058abcd85e8b233af7cb4e01191c75f4?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/fdce01bbdb8b8eaa162f8ed372062707058abcd85e8b233af7cb4e01191c75f4?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/fdce01bbdb8b8eaa162f8ed372062707058abcd85e8b233af7cb4e01191c75f4?s=96&d=mm&r=g","caption":"Sam"},"description":"Sam Nguyen is the CEO and founder of Avada Commerce, an e-commerce solution provider headquartered in Vietnam. He is an expert on the Shopify e-commerce platform for online stores and retail point-of-sale systems. Sam loves talking about e-commerce and he aims to help over a million online businesses grow and thrive.","sameAs":["https:\/\/wordpress-466542-3512282.cloudwaysapps.com","https:\/\/vn.linkedin.com\/in\/samng80"],"url":"https:\/\/avada.io\/authors\/sam\/"}]}},"meta_title":"How to Get Item with specified index in Array in Liquid in Shopify","meta_description":"Learn to retrieve array items by index in Shopify Liquid with our developer-friendly guide and code examples.","meta_keywords":"liquid array index, shopify array, shopify liquid assign array, shopify create array of objects, shopify liquid array, shopify for loop index, liquid create array, liquid for index, create array liquid, liquid for loop index, liquid filter array, shopify loop index, shopify liquid for index, liquid remove item from array, shopify array filters, shopify create array, create array in liquid, for loop index shopify, shopify liquid for loop index, for loop index in shopify","feature_image_custom":"","updated_at_migrate":"2024-08-30T21:43:02+07:00","_links":{"self":[{"href":"https:\/\/avada.io\/wp-json\/wp\/v2\/posts\/111371","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/avada.io\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/avada.io\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/avada.io\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/avada.io\/wp-json\/wp\/v2\/comments?post=111371"}],"version-history":[{"count":2,"href":"https:\/\/avada.io\/wp-json\/wp\/v2\/posts\/111371\/revisions"}],"predecessor-version":[{"id":158831,"href":"https:\/\/avada.io\/wp-json\/wp\/v2\/posts\/111371\/revisions\/158831"}],"wp:attachment":[{"href":"https:\/\/avada.io\/wp-json\/wp\/v2\/media?parent=111371"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/avada.io\/wp-json\/wp\/v2\/categories?post=111371"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/avada.io\/wp-json\/wp\/v2\/tags?post=111371"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}