Shopify Liquid Cheat Sheet: The Filters, Tags and Objects You Actually Use

Shopify Liquid cheat sheet: about 40 filters and tags cover daily theme work, on one printable page

You push a theme change, open the preview, and a price shows up a hundred times too small or a snippet renders blank. You fix one character and push again. That loop is where theme hours go, and it nearly always traces back to the same 40 or so filters, tags and objects used slightly wrong.

TL;DR: Format prices with money (it expects cents), output images with image_url plus a width, pull snippets in with render (never include), and paginate any loop over a collection, because an unpaginated for stops at 50 items. Below are the filters, tags and objects I use on real themes, with copy-paste snippets and a one-page PDF.

Shopify Liquid reference documentation open in a code editor, the everyday filters and tags a theme developer reaches for

Download the Liquid cheat sheet (PDF)

Why keep a Liquid cheat sheet at all

  • Shopify has run Liquid in production since 2006 and publishes the core as open-source Liquid, but themes run Shopify’s dialect, with objects and filters like product, money and image_url that a Jekyll site doesn’t have.
  • The Shopify Liquid reference is huge, but a theme edit usually needs six or seven objects and a dozen filters, so a short list is faster than search.
  • Most theme bugs I fix are small slips: money on a value that isn’t in cents, include where render belonged, a for loop over a big collection with no paginate. The syntax is the same on every plan, so Plus stores hit these slips too (what a Shopify Plus developer adds is checkout, Functions and B2B work, not different Liquid).
  • Deploying is a separate skill with its own companion Shopify CLI cheat sheet, so this page stays on the Liquid you type.

How do you format a price in Shopify Liquid?

Use the money filter. Shopify stores every price in the currency’s subunit (cents), so a product.price of 1000 is ten dollars, and money formats it with your store’s “HTML without currency” setting.

Liquid
{{ product.price | money }}                 {% comment %} $10.00 {% endcomment %}
{{ product.price | money_with_currency }}   {% comment %} $10.00 USD {% endcomment %}
{{ product.price | money_without_trailing_zeros }}
{{ product.compare_at_price | money }}      {% comment %} was-price {% endcomment %}

The rule I never break: no hardcoded $ in a theme, ever. A store that sells in more than one currency shows the wrong symbol the moment you do. If you have hardcoded prices lurking in a theme, the multi-currency hardcoded price fix is the deeper read.

The reverse slip catches people too. A price you saved yourself as 19.99 in a decimal metafield isn’t in cents, so money prints it a hundred times too small. Store it in a money-type metafield instead, whose .value works with money like any product price.

Which Liquid filters do you actually use?

A handful of string, math, and array filters cover most of what you write. They chain left to right with the pipe, so each filter takes the output of the one before it.

Liquid
{{ 'HELLO' | downcase | capitalize }}        {% comment %} Hello {% endcomment %}
{{ product.title | handleize }}              {% comment %} url-safe handle {% endcomment %}
{{ product.description | strip_html | truncatewords: 30 }}
{{ item.line_price | divided_by: item.quantity | money }}
{{ product.tags | join: ', ' }}
{{ price | default: 0 | money }}
{{ 'products.product.add_to_cart' | t }}     {% comment %} text from a locale file {% endcomment %}
{{ 'theme.css' | asset_url | stylesheet_tag }}

default is the quiet workhorse here: it swaps in a fallback when a value is empty or nil, which stops half your “why is this blank” bugs before they render. t (short for translate) pulls text from the theme’s locale files, so a merchant can translate “Add to cart” without touching code. asset_url gives a file in your theme’s assets folder its CDN URL, so you never type one. The reference lists the rest, but these are the ones worth memorizing.

How do you set variables and write logic in Liquid?

assign stores a value, capture stores rendered markup, and if, unless and case decide what renders. Comparisons use ==, !=, >, < and contains. Liquid has no not keyword, so you write unless or != instead.

Liquid
{% assign in_stock = product.available %}
{% capture heading %}{{ section.settings.title | default: collection.title }}{% endcapture %}

{% if product.available and product.compare_at_price > product.price %}
  On sale
{% elsif product.available %}
  In stock
{% else %}
  Sold out
{% endif %}

{% unless customer %}Log in for member pricing{% endunless %}

{% case product.type %}
  {% when 'Shirt', 'Hoodie' %}Size guide
  {% else %}Care guide
{% endcase %}

{% if product.tags contains 'final-sale' %}No returns{% endif %}

{% liquid
  assign count = cart.item_count
  if count > 0
    echo count
  endif
%}

capture beats a chain of append filters whenever the value mixes text and Liquid. The liquid tag drops the braces for a block of logic, with echo for output, which keeps long logic readable. A when takes several values separated by commas, and the unless tag reads cleaner than if with == false.

One rule surprises almost everyone. Mixed and and or conditions evaluate right to left, and Liquid doesn’t allow parentheses to change that, which is why operator precedence with and vs or gets its own walk-through.

Which Liquid objects do you touch every day?

Objects are the data Shopify hands your template. Some are global and work on any page (shop, cart, settings, request, routes, and customer when someone is logged in). Others come from the page you’re on, like product on a product template and collection on a collection page.

Object What I use it for Example
product Title, price, images, variants product.selected_or_first_available_variant
variant One option combination: price, SKU, stock variant.available
collection The product list and counts collection.products_count
cart Item count, totals, line items cart.item_count
customer The logged-in shopper, nil for guests customer.first_name
shop Store name, URL, currency shop.name
settings Theme settings from settings_schema.json settings.logo
section.settings A section’s schema settings section.settings.heading
request Page type, path, locale, theme editor check request.design_mode
routes Storefront URLs without hardcoding routes.cart_url
product.metafields Custom data you defined product.metafields.custom.subtitle.value
Liquid
{% if customer %}Hi {{ customer.first_name }}{% endif %}
<a href="{{ routes.cart_url }}">Cart ({{ cart.item_count }})</a>
{% if request.design_mode %}{% comment %} theme editor only {% endcomment %}{% endif %}

{% form 'product', product %}
  <input type="hidden" name="id" value="{{ product.selected_or_first_available_variant.id }}">
  <button type="submit">{{ 'products.product.add_to_cart' | t }}</button>
{% endform %}

Two traps I see on audits. Reading customer.first_name without checking customer first gives guests a greeting with a blank where the name should be. Typing /cart instead of routes.cart_url skips the URL helper Shopify built so links keep working across languages and future URL changes.

The form tag writes the form element, its action and Shopify’s hidden fields for you; the product form takes the product as its second argument. And product.variants returns at most 250 variants without paginate, which is the trap behind the 250-variant cap fix.

How do you loop through products in Liquid?

The for tag walks any array, like collection.products. limit and offset trim it, forloop.index gives you position, and an else branch handles the empty state cleanly. Past 50 items you also need paginate, covered just below the snippet.

Liquid
{% for product in collection.products limit: 4 %}
  {{ forloop.index }}. {{ product.title }} - {{ product.price | money }}
{% else %}
  No products in this collection yet.
{% endfor %}

On large collections the trap is products that never show up. A for loop runs at most 50 iterations per page, so an unpaginated loop over a 900-product collection stops at product 50 and shoppers never see the rest. Wrap it in {% paginate collection.products by 24 %} (any page size from 1 to 250) and add page links.

The less obvious one: limit: 4 doesn’t cut what Shopify fetches. The paginate tag docs say collection.products still pulls up to 50 products whatever your limit is. For a four-product strip, wrap the loop in a matching paginate and skip the page links.

Liquid
{% paginate collection.products by 4 %}
  {% for product in collection.products limit: 4 %}
    {% render 'product-card', product: product %}
  {% endfor %}
{% endpaginate %}

I go further in the Liquid loop optimization guide, and the break and continue reference covers early exits.

What is the difference between render, include, and section?

render pulls in a snippet with an isolated scope, so it only sees the variables you hand it. That isolation is the whole point: no accidental leaks from the parent template, no ghost variables, far fewer bugs.

Liquid
{% render 'product-card', product: product, show_vendor: true %}
{% render 'price' for collection.products as product %}
{% section 'featured-collection' %}
{% sections 'footer-group' %}

include shares the parent scope, and Shopify deprecated it because that way of handling variables hurts performance and makes code harder to maintain. Treat any include you find as tech debt and swap it for render. When you need to pass data in, named parameters on render keep the snippet contract explicit, and custom Liquid sections show the pattern on a full section.

How do you output an image without a raw CDN URL?

Never paste a cdn.shopify.com URL into a theme. Run the image through image_url with a width, and let image_tag build the responsive markup for you, including a srcset the browser picks from. That’s one line of Liquid instead of a hand-written img tag.

Liquid
{{ product.featured_image | image_url: width: 800 }}
{{ product.featured_image
   | image_url: width: 1200
   | image_tag: alt: product.title }}
{{ image
   | image_url: width: 800, height: 800, crop: 'center'
   | image_tag: loading: 'lazy' }}

image_url needs a width or a height, and with neither Shopify returns an error, so you can’t skip it. Pick a width near the largest size the slot shows, and image_tag writes a srcset of smaller widths up to that maximum. A raw CDN URL gives you one fixed file and no srcset at all, which costs you load time on phones (the image_url filter reference has every parameter).

Keep loading: 'lazy' off the main product photo and anything else above the fold. image_tag already lazy loads images in sections further down the page, and Shopify’s own guidance is not to lazy load what the shopper sees first.

What Liquid mistake do I catch most on audits?

A loop inside a loop. I open a slow collection template and find a for over the products with a second for inside it, walking each product’s variants or tags to find one match. Shopify’s guide to nested Liquid loops spells out the cost: outer passes times inner passes, so 50 products with 10 variants each is 500 iterations, and the work grows faster than the catalog.

The fix is usually a filter, not more code. where and map do in one line what a nested loop does in ten. Per the same guide, a where call does the comparison in one filter call instead of running a tag, a condition and a loop pass for every product.

Liquid
{% assign in_stock = collection.products | where: 'available' %}
{% assign titles   = collection.products | map: 'title' %}
{{ collection.products.size }}   {% comment %} count, no loop {% endcomment %}

I go through the server cost in the true cost of Liquid loops. If your collection pages feel heavy, start there before you touch a single app.

Where do you go when you need more than the cheat sheet?

This cheat sheet is the map. When you hit a specific problem, each of these posts is the detailed walk-through, with the edge cases and fixes that don’t fit on one printable page:

The takeaway

Liquid is small once you stop trying to hold all of it. Keep the PDF open in a split pane, let the reference carry the long tail, and if the theme backlog outgrows your own hours, the fractional Shopify developer vs full-time hire math shows which one costs less.

  • Format every price with money and feed it cents, because that’s how Shopify stores prices.
  • Search your theme for include and cdn.shopify.com, and swap each hit for render or image_url.
  • Paginate every loop over a collection, since an unpaginated for stops at 50 items.
  • Check customer before you read it, and build links with routes instead of typed paths.
  • Open your slowest collection template, find the loop inside a loop, and replace it with where or map.

Kaspian Fuad is a Shopify developer and CRO consultant who builds and audits Liquid themes for DTC brands. 12 years in ecommerce, 100+ stores, Top Rated Plus on Upwork; the background is on the about page and the results are in the case studies. Book a free 30-minute call if you want a theme audited for the loops and legacy tags quietly costing you speed.

Frequently Asked Questions

What is a Shopify Liquid cheat sheet?

A Shopify Liquid cheat sheet is a quick reference for the Liquid filters, tags, and objects that build Shopify themes: price formatting with the money filter, image_url for images, render for snippets, and for loops for products. Shopify uses its own extended Liquid dialect, not the plain open-source version.

How do you format a price in Shopify Liquid?

Use the money filter: {{ product.price | money }}. Shopify stores prices in cents, so a product.price of 1000 renders as $10.00. Use money_with_currency to append the ISO code, and never hardcode a currency symbol in theme code.

What is the difference between render and include in Liquid?

render runs a snippet in an isolated scope, so it only sees the variables you pass in, which prevents variable leaks and hard-to-trace bugs. include shares the parent scope and is deprecated. Shopify recommends render for all new theme code.

How do you loop through products in Liquid?

Use {% for product in collection.products %}…{% endfor %}. Add limit and offset to trim the list and forloop.index for position. A for loop runs at most 50 iterations per page, so wrap any collection with more than 50 products in {% paginate collection.products by 24 %} or the rest never render.

Is Shopify Liquid the same as standard Liquid?

No. Shopify created Liquid, has run it in production since 2006, and publishes it as open source, but the Shopify platform adds filters and objects (money, image_url, product, cart, section) that standard Liquid does not ship. Code written for Jekyll or another Liquid engine will not fully run on Shopify.

How do I comment out code in Liquid?

Wrap a block in {% comment %}…{% endcomment %}, or use the inline {% # note %} form for a single line. Commented Liquid is stripped before the page renders, so it never reaches the browser.

Part of the Liquid guide.

Book a free call