Shopify Liquid is the template language built into every Shopify theme. When a customer opens a product page, cart, or blog post, Liquid reads your store’s data and fills in the page before it reaches the browser. No request ever sends a Liquid tag to the customer’s screen - the server renders it and delivers finished HTML.

This guide explains what Liquid does, how the files fit together, and covers the objects, tags, filters, and code examples you need to work with Shopify themes confidently.

Key Takeaways
1
Liquid runs on Shopify’s servers, not in the browser - the customer sees finished HTML, not template code.
2
Every Shopify theme is made of four file types: layout files, template files, section files, and snippets.
3
Objects pull store data like titles and prices; tags add logic like loops and conditions; filters format the output.
4
The date filter and the money filter are the two most-used filters in real Shopify themes.

What is Shopify Liquid?

Shopify developed Liquid in 2006 as an open-source templating language for building online store themes. For Shopify specifically, Liquid is what connects raw store data, products, prices, collections, customer accounts, and cart contents to the HTML that customers see.

The language has three moving parts:

  • Objects output data. {{ product.title }} prints the product’s name wherever you place it.
  • Tags control logic. {% if product.available %} shows content only when the condition is true.
  • Filters format output. {{ product.price | money }} turns a raw number into a currency string.

All three work together inside .liquid files stored in your theme’s code. The Liquid engine processes these files on Shopify’s servers each time a page is requested, then sends the finished HTML to the browser.

How Liquid files are organized in a Shopify theme

A Shopify theme is a folder of Liquid files, each with a specific job. Understanding the four file types makes it much easier to know where to look when you want to change something.

Layout files (layout/) form the outer frame that wraps every page. theme.liquid is the main one - it contains the <html>, <head> and <body> tags and uses {{ content_for_layout }} to pull in whatever the current page template produces.

Template files (templates/) control what shows on each page type. product.liquid handles product pages, collection.liquid collection pages, and cart.liquid the cart. Modern Shopify themes also support JSON templates (product.json) that reference sections instead of writing markup directly.

Section files (sections/) are content blocks that merchants can add to any page from the Theme Editor. Each section file contains a {% schema %} tag that defines the settings a merchant can change, things like a heading, a color, or a layout option.

Snippets (snippets/) are small reusable pieces of code included with {% render 'snippet-name' %}. A product card, an icon, or a form field might each live in its own snippet so the same code can be used across multiple templates without duplication.

Shopify Liquid objects

Objects are the data layer of Shopify Liquid. Each object represents a piece of your store - a product, a collection, the customer, the cart - and you access its properties using dot notation inside double curly braces.

{{ product.title }}

Products have dozens of properties. These are the ones used most often in theme templates:

  • product.title - the product name
  • product.price - price in cents (use with the money filter to format it)
  • product.description - the full HTML description
  • product.available - true if any variant is in stock
  • product.images - an array of product images
  • product.url - the product’s URL relative to the store

Other common top-level objects include collection, cart, customer, shop, article, page, and settings (for global theme settings). Inside section files you also have section.settings for the settings a merchant configured in the Theme Editor, and block.settings for the settings on individual theme blocks.

For example, to display a product’s price formatted as money:

{{ product.price | money }}

Shopify Liquid tags

Tags control how your theme behaves. They handle conditionals, loops, variable assignments, and other logic. Tags use curly brace and percent symbols and do not produce any visible output themselves.

{% if product.available %}
  Add to cart
{% else %}
  Sold out
{% endif %}

The most common tags in Shopify themes:

  • if / elsif / else / endif - conditional content
  • unless / endunless - the inverse of if (show unless condition is true)
  • for / endfor - loop over an array
  • assign - create a variable
  • capture / endcapture - save a block of rendered content to a variable
  • render - include a snippet file (the modern replacement for the deprecated include)
  • comment / endcomment - a note that does not render on the page
  • paginate / endpaginate - split long product or article lists across multiple pages

Loop tags support extra controls: limit: caps how many items render, offset: skips a number of items, and break and continue exit or skip iterations early. For example, to show just the first 4 products in a collection:

{% for product in collection.products limit: 4 %}
  {{ product.title }}
{% endfor %}

Shopify Liquid filters

Filters modify values before they are output. You chain them after a pipe symbol (|) inside double curly braces, and you can stack multiple filters in a row - the output of each one feeds into the next.

{{ product.title | upcase | truncate: 40 }}

That example converts the title to uppercase and trims it to 40 characters. Common filters:

  • money - formats a cents value as a currency string using your store’s currency settings
  • date - formats a timestamp (see the date cheat sheet below)
  • upcase / downcase - changes string case
  • truncate - shortens a string to a character limit
  • default - returns a fallback when the value is blank or nil
  • image_url - generates a resized image URL for a Shopify image object
  • append / prepend - adds text to the end or start of a string
  • size - returns the number of items in an array or characters in a string
  • where - filters an array to items where a property matches a value
  • asset_url - returns the URL of a file in your theme’s assets folder

Practical Shopify Liquid examples

Here are five patterns used in real Shopify themes, covering the most common tasks.

1. Display product details

Output a product’s title, price and description from within any product template file.


{{ product.title }}


{{ product.price | money }}


{{ product.description }}

2. Customize layouts based on conditions

Use an if statement to change what renders based on a product’s type, availability, or any other property.

{% if product.type == 'Shirt' %}
  
{% elsif product.type == 'Pants' %}
  
{% else %}
  
{% endif %}

3. Iterating over collections

A for loop steps through every product in a collection and outputs whatever you specify for each one.

{% for product in collection.products %}
  {{ product.title }}
  {{ product.description }}
{% endfor %}

4. Personalize for logged-in customers

Shopify’s customer object is only available when a customer is logged in, so wrap it in an if check to avoid errors on pages viewed by guests.

{% if customer %}
  Welcome back, {{ customer.first_name }}!
{% endif %}

5. Format and transform data

Chain filters to control exactly how a value appears on screen.


{{ product.title | upcase }}


{{ article.published_at | date: "%b %d, %Y" }}

Debugging Shopify Liquid

Liquid fails silently by default: undefined variables output an empty string rather than an error message, and a typo in an object name simply produces nothing on screen. Here are the main techniques for finding and fixing problems in Liquid code.

Output a variable as JSON

Add {{ variable | json }} anywhere in a template to print the full contents of a Liquid object to the page. This is the fastest way to check what data is actually available in context:

{{ product | json }}

That prints every property on the product object so you can see exactly which keys exist and what values they hold. Remove it before publishing to your live store.

Use the Shopify CLI for live error output

Running shopify theme dev starts a local preview of your theme and prints Liquid rendering errors to the terminal as they happen. Errors that would be silent on the live store appear as explicit messages in the CLI output, including the file name and line number. This is the most reliable way to catch syntax errors.

Stop Liquid from processing a block

The {% raw %} tag prevents Liquid from interpreting anything inside it, which is useful when you need to display Liquid syntax as literal text rather than run it:

{% raw %}
  {{ product.title }} will not be rendered as Liquid here
{% endraw %}

Catch undefined values with the default filter

When a property might not exist for every product or page, the default filter returns a fallback instead of leaving the space blank:

{{ product.vendor | default: "Our brand" }}

This is particularly useful for optional metafields or properties that only some products have set.

Use comments to temporarily reveal values

To debug without showing raw output to visitors, wrap the JSON output in a comment tag and view the page source rather than the rendered page:

{% comment %}{{ product | json }}{% endcomment %}

The value does not render visually but appears in the HTML source when you view it in the browser’s developer tools.

Best practices for Shopify Liquid

A few habits make Liquid code easier to maintain and edit later.

  • Use consistent indentation. Liquid files mix HTML and template logic. Keeping indentation consistent inside loops and conditionals makes the structure obvious at a glance.
  • Prefer render over include. The render tag creates a separate scope, so variables in the parent do not leak into the snippet. include is deprecated in Online Store 2.0 themes.
  • Keep logic out of templates. Liquid is for display, not computation. If you need complex conditional logic, simplify it into a boolean or a named variable with assign rather than nesting many conditions inline.
  • Use comments for context, not narration. {% comment %}{% endcomment %} blocks are stripped at render time and add no page weight. Use them to explain non-obvious decisions, not to describe what obvious code does.
  • Test on a development theme. Shopify lets you duplicate any theme before editing. Make changes on the duplicate first so the live store is not affected while you work.
  • Use limit on large loops. Loops that iterate through hundreds of products on a single page create slow render times. Use limit: and paginate to keep pages fast.

Cheat Sheet: Quick Reference for Shopify Liquid

The tables below cover the most-used objects, tags, filters, and date format codes in Shopify theme development.

Common Liquid objects

Objects output store data. Wrap them in double curly braces.

Object What it outputs
{{ product.title }} The product’s name
{{ product.price | money }} The product price, formatted as money
{{ collection.title }} The current collection’s name
{{ cart.item_count }} Number of items in the cart
{{ customer.first_name }} The logged-in customer’s first name
{{ shop.name }} Your store’s name
{{ article.published_at }} A blog article’s publish date

Common Liquid tags

Tags add logic. Wrap them in curly brace and percent symbols.

Tag What it does
{% if %} ... {% endif %} Show content only when a condition is true
{% unless %} ... {% endunless %} Show content unless a condition is true
{% for item in collection %} ... {% endfor %} Loop over a list
{% assign var = value %} Create a variable
{% capture var %} ... {% endcapture %} Save a block of content to a variable
{% render 'snippet' %} Include a reusable snippet file (the modern replacement for include)
{% comment %} ... {% endcomment %} Leave a note that does not render

Common Liquid filters

Filters change how data looks. Add them after a pipe inside the braces.

Filter Example Result
money {{ 1999 | money }} $19.99
date {{ article.published_at | date: "%B %d, %Y" }} October 22, 2026
upcase {{ product.title | upcase }} SNEAKERS
truncate {{ product.description | truncate: 50 }} First 50 characters, then an ellipsis
default {{ product.vendor | default: "Our brand" }} A fallback when the value is blank
image_url {{ product.featured_image | image_url: width: 600 }} A resized image URL

Formatting dates in Liquid

The date filter turns a timestamp into readable text using format codes:

{{ article.published_at | date: "%B %d, %Y" }}
Code Output
%Y Four-digit year (2026)
%m Month number (10)
%B / %b Month name (October / Oct)
%d Day of the month (22)
%A Weekday name (Thursday)
%H:%M 24-hour time (14:30)