Blog

Create an array in Shopify's liquid

Still works in 2025!

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.
  • Strike Automatic Discounts: Ditch your discount codes with automatic discounts for eligible customers.
  • 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.

See documentation

Related articles

Code

Shopify Admin GraphQL API + gql.tada = ❤️

Code

How to implement access control on your Shopify store

Code

How to add extra customer data to Shopify orders