Common Shopify Liquid Mistakes
Avoid these frequent beginner errors that break layouts, crash pages, or ruin store performance.
1. Forgetting to Escape Output
If a merchant types <script> into a standard text setting, and you output it directly, it could break your layout or cause security issues. Always use the escape filter for plain text.
<!-- Bad -->
<h2>{{ section.settings.title }}</h2>
<!-- Good -->
<h2>{{ section.settings.title | escape }}</h2>
2. Incorrect Loop Limits
Shopify enforces a strict 50-item limit on pagination. If you try to loop through collection.products without pagination, it will silently cap at 50.
{% paginate collection.products by 12 %}
{% for product in collection.products %}
...
{% endfor %}
{{ paginate | default_pagination }}
{% endpaginate %}
3. Assigning Booleans as Strings
When checking conditions, remember that Liquid has true boolean values.
<!-- Bad -->
{% if product.available == 'true' %}
<!-- Good -->
{% if product.available %}
4. Using Javascript inside Liquid Loops
If you output a <script> tag inside a for loop, you will generate identical scripts multiple times, destroying performance. Always put scripts outside loops, and pass data via data-attributes instead.
5. Forgetting block.shopify_attributes
Without {{ block.shopify_attributes }} on block wrappers, the theme editor cannot highlight individual blocks—merchants think the section is "broken."
6. Using Deprecated img_url
Replace img_url with image_url and image_tag. Details in our Image Optimization Guide.
Build faster with HTMLToLiquid Converter
Convert static HTML into dynamic Shopify sections.
Open converter