Helium Development

Saved

- Edit All
A quick way to create an array in Shopify's liquid.

According to Shopify’s documentation, you can’t create arrays with liquid.

Jun 06, 2015

So it’s not as clean as something like:

{% assign fruits = ["orange", "apple", "peach"] %}

But instead you can create accessible arrays in liquid using the split filter:

{% assign fruits = "orange,apple,peach" | split: ',' %}

Even though is not particularly elegant, it does the job. You can then loop over this array and do whatever you like:

{% for fruit in fruits %}
  {{ fruit }}
{% endfor %}

And voila.

A quick way to create an array in Shopify's liquid.