5 Liquid hacks that will improve your workflow

Here are 5 Liquid hacks that will improve your workflow as a Shopify developer ๐Ÿค“

I hope you had a good start to the new year and are ready to become even better and more successful as a Shopify developer.
To start things off in 2026, I prepared 5 Liquid hacks I use regularly to write better code.

๐Ÿ. ๐“๐ฎ๐ซ๐ง ๐š ๐ฌ๐ญ๐ซ๐ข๐ง๐  ๐ข๐ง๐ญ๐จ ๐š ๐ง๐ฎ๐ฆ๐›๐ž๐ซ
Various scenarios during theme development can result in numbers being returned as strings! The disadvantage of storing numbers as strings is that they won't work with math filters for calculations.
To turn a number-string into a number, you can use the | ๐‘๐‘™๐‘ข๐‘ : 0 filter

๐Ÿ. ๐“๐ฎ๐ซ๐ง ๐š ๐ง๐ฎ๐ฆ๐›๐ž๐ซ ๐ข๐ง๐ญ๐จ ๐š ๐Ÿ๐ฅ๐จ๐š๐ญ
The same goes for having numbers instead of floats! This can get tricky when calculating percentages, e.g., while building progress bars or compare_at_price/price savings.
If you have a number and actually want to calculate with a float, you can useย | ๐‘ก๐‘–๐‘š๐‘’๐‘ : 1.0ย to turn a number into a float.


๐Ÿ‘. ๐†๐ž๐ง๐ž๐ซ๐š๐ญ๐ข๐ง๐  ๐œ๐ฎ๐ฌ๐ญ๐จ๐ฆ ๐š๐ซ๐ซ๐š๐ฒ๐ฌ
Liquid does not allow us to create custom arrays from data. We have some filters, likeย ๐‘คโ„Ž๐‘’๐‘Ÿ๐‘’ ๐‘œ๐‘Ÿ ๐‘š๐‘Ž๐‘,ย that can create arrays from already existing arrays. But to create arrays with our own data we can do the following:
- Assign a variable to an empty string
- Append desired data to that empty string, seperated by a comma
- Split that string at the comma to get an array


๐Ÿ’. ๐ƒ๐ž๐›๐ฎ๐ ๐ ๐ข๐ง๐  ๐ฐ๐ข๐ญ๐ก ๐ฃ๐ฌ๐จ๐ง ๐Ÿ๐ข๐ฅ๐ญ๐ž๐ซ
I already mentioned this in another post! Debugging in Liquid is 99% of the time just outputting data to check what it actually contains. And many people use plain output to do that.

But this is bad practice!

Plain output in the frontend is hard to read and can leave clutter behind if you forget to remove the debug.
A much better approach is to useย <๐‘ ๐‘๐‘Ÿ๐‘–๐‘๐‘ก> ๐‘ก๐‘Ž๐‘”๐‘ /๐‘๐‘œ๐‘›๐‘ ๐‘œ๐‘™๐‘’.๐‘™๐‘œ๐‘”()ย in combination with theย ๐‘—๐‘ ๐‘œ๐‘›ย filter to output data in the console of your browser.


๐Ÿ“. ๐’๐ž๐œ๐ญ๐ข๐จ๐ง/๐›๐ฅ๐จ๐œ๐ค ๐ฌ๐ฉ๐ž๐œ๐ข๐Ÿ๐ข๐œ ๐ฌ๐ญ๐ฒ๐ฅ๐ข๐ง๐ 
Did you know that every section and theme block is automatically wrapped by a <๐‘‘๐‘–๐‘ฃ> with a unique ID that you can use to give that section/theme block specific CSS? The structure is simple and uses theย resource's ID. See below for an example.


Use these hacks to improve your workflow ๐Ÿ˜Ž

Back to blog

Want to learn more?

Join my Shopify developer course programm and bring your skills to the next level!

Join now