Create an array in Shopify's liquid
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:
Thankfully, there’s a workaround!
You can use the
split filter to create accessible arrays in liquid:
It’s not particularly elegant, but it does the job. You can then loop over this array and do whatever you like:
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 apps:
- Customer Fields allows you to build custom registration forms and retrieve valuable data from customers at just the right time.
- Meteor Mega Menu offers a variety of beautiful dropdown menu templates which you can attach to your exisiting Shopify navigation, meaning your store could have a menu makeover in minutes.