Code
Create an array in Shopify's liquid
A quick way to create an array in Shopify's liquid.
Nick Mealey • Published: June 6, 2016 •
Updated: February 9, 2026 • 1 min read
According to Shopify's documentation, you can't create arrays with liquid.
Unfortunately, that means you can't do something simple and clean like this:
{% assign fruits = \["orange", "apple", "peach"] %}Thankfully, there's a workaround!
You can use the split filter to create accessible arrays in liquid:
{% assign fruits = "orange,apple,peach" | split: ',' %}It's not particularly elegant, but it does the job. You can then loop over this array and do whatever you like:
{% for fruit in fruits %}
{{ fruit }}
{% endfor %}And voila.
Being able to capture arrays with liquid opens up a lot of possible applications for your Shopify store!
Find this helpful? You might also like our Shopify apps:
- Customer Fields: Build custom registration forms or customer profile forms and retrieve valuable data from customers at just the right time.
- Onboard B2B: Native Shopify B2B onboarding for Shopify Plus stores.
- Meteor Mega Menu: Build beautiful menus in minutes. Choose from a variety of beautiful dropdown menu templates which you can attach to your existing Shopify navigation.
Build with Customer Fields
Customer Fields is more than just a form builder. It’s a platform for developers to build unique experiences on Shopify using zero-party and first-party data.