DEV Community

Alexandr M.
Alexandr M.

Posted on • Edited on • Originally published at shopify.ecom-store.pro

What Is Shopify Liquid? Syntax, Use Cases, and Limitations

If you have ever cloned a Shopify theme into your editor and stared at a wall of {{ }} and {% %} tags, this is the language you were looking at. Liquid is the template layer that sits between a store's data and the HTML a browser finally renders. Before you can safely change a single line in a theme, it helps to understand what Liquid actually does, and — just as importantly — what it refuses to do.

This guide is written for the developer or tech-savvy merchant who wants to customize a theme rather than fight the visual editor. We will walk through the three building blocks (objects, tags, filters), the theme file structure, real code you will actually ship, where Liquid's sandbox draws the line, and what Liquid work costs when you hand it to someone else. Every code sample below is copy-paste ready.

One framing note up front: Liquid is intentionally limited. It renders pages; it does not run your backend. If you are coming from a general-purpose language, the mental-model shift is the whole game, so this piece is explicit about the boundaries. Some of the original article's interactive pieces (a capability radar chart, a cost chart, an embedded video tutorial) do not translate to a plain markdown feed — where that happens, I point you to the interactive version on the original post.

Key takeaways

  • Liquid is Shopify's template language — it connects your store data to the HTML that customers see in the browser.
  • Open-source and stable — created by Shopify in 2006, written in Ruby, and used by millions of stores worldwide.
  • You do not need Liquid for most changes — the theme editor handles colors, fonts, layout, and sections without code.
  • Liquid developers cost $25–$150/hr — simple edits run $150–$500; custom sections or cart logic run $500–$2,000+.
  • Three building blocks — objects output data, tags control logic, and filters transform output.
  • Wrong Liquid breaks visuals, not the server — it is sandboxed, but bad code can show wrong prices or break mobile layouts.

What Is Shopify Liquid?

Liquid is Shopify's template language — a set of simple code instructions that tell Shopify how to display your store's data (products, prices, collections, customer info) inside HTML pages. When a customer visits your store, Shopify processes the Liquid code in your theme files, replaces it with real data, and sends the final HTML to the browser.

Created by Shopify co-founder and CEO Tobias Lütke in 2006, Liquid was designed to be safe and easy to read. It is an open-source template language written in Ruby with over 11,800 stars on GitHub. Unlike general-purpose programming languages, Liquid runs in a sandbox — it cannot access the server's file system, make network requests, or execute arbitrary code. That is what makes it safe for theme developers to write code that runs on Shopify's infrastructure.

"Liquid is a template language created by Shopify. It's available as an open source project on GitHub, and is used by many different software projects and companies."

— Shopify Developer Documentation, Liquid reference

A few numbers on where Liquid stands, per the Shopify/liquid repository on GitHub: in production at Shopify since 2006, 11,800+ GitHub stars, and 193 contributors worldwide.

Here is the key distinction: Liquid is the code behind your theme, not something merchants interact with directly. When someone uses the theme editor to change colors or rearrange sections, they are adjusting settings that Liquid code reads and applies. Liquid is the engine; the theme editor is the steering wheel.

Do You Need Liquid?

Most store owners never need to write Liquid. Whether it is relevant to you depends entirely on your role and how often the store changes.

Your role Learn Liquid? Why
Store owner (1 store) No — hire when needed One-off developer tasks cost $150–$500; learning Liquid takes weeks.
Store owner (frequent changes) Learn basics Basic Liquid saves $200–$500/month in developer fees for minor tweaks.
Marketing manager Learn to read Understanding Liquid helps you brief developers more effectively.
Freelance developer Yes — essential Liquid is the core skill for Shopify theme development work.
Agency team Yes — essential Every Shopify agency project involves Liquid at some level.

If you are a developer reading this on dev.to, you are almost certainly in the bottom two rows: Liquid is the price of admission for Shopify theme work.

How Liquid Works: Objects, Tags, and Filters

Every Liquid file in a Shopify theme is a mix of HTML and Liquid code. Shopify processes the Liquid parts on its servers, replaces them with real data, and sends pure HTML to the customer's browser. The customer never sees Liquid code — only the final rendered page.

"A template language allows you to create a single template to host static content, and dynamically insert information depending on where the template is rendered. For example, you can create a product template that hosts all of your standard product attributes, such as the product image, title, and price. That template can then dynamically render those attributes with the appropriate content, depending on the current product being viewed."

— Shopify Developer Documentation, Liquid reference

Liquid has exactly three building blocks:

  • Objects — output data. Objects are wrapped in double curly braces: {{ product.title }}, {{ cart.total_price | money }}. They pull live data from your store and display it on the page. Think of them as placeholders that Shopify fills with real values.
  • Tags — control logic. Tags use {% %} syntax: {% if product.available %}, {% for product in collection.products %}. They control what appears, loop through items, and handle conditional logic — without outputting anything themselves.
  • Filters — transform output. Filters modify objects using the pipe character: {{ product.price | money }}, {{ 'hello' | upcase }}. They format numbers, dates, strings, URLs, and more — chained left to right.

Here is a practical example that ties all three together. This Liquid code displays a product's title and formatted price, but only if the product is available for purchase:

{% if product.available %}
  <h1>{{ product.title }}</h1>
  <p class="price">{{ product.price | money }}</p>
  <button>Add to Cart</button>
{% else %}
  <p>This product is currently sold out.</p>
{% endif %}
Enter fullscreen mode Exit fullscreen mode

In this example, {{ product.title }} is an object that outputs the product name. {% if product.available %} is a tag that checks availability. | money is a filter that formats the raw price integer into a currency string like "$29.99". For the full list of available objects, tags, and filters, see the Liquid documentation.

Where Liquid Lives: Theme File Structure

Liquid code is organized into specific directories within a Shopify theme. Knowing this structure helps you know where to look (or where to tell a developer to look) when you need changes.

Directory Contains Role
layout/ theme.liquid Master wrapper — header, footer, global scripts
templates/ JSON files Define which sections appear on each page type
sections/ .liquid files Modular page blocks added via the theme editor
snippets/ .liquid files Reusable code fragments (price display, badges)
assets/ CSS, JS, images Static files served to the browser
config/ settings_schema.json Theme-wide settings visible in the editor
locales/ .json files Translation strings for multi-language stores

Source: Shopify Theme Architecture.

The original post embeds a full 45-minute Liquid tutorial video walking through this file structure and building custom sections from scratch. Watch the embedded version on the original article.

Liquid vs No-Code: When You Need Each

The theme editor handles the bulk of everyday customization. Liquid is for what it cannot reach — conditional logic, custom sections, dynamic data, and performance work.

Customization Theme editor Liquid code
Change colors & fonts Yes No
Rearrange page sections Yes No
Add/remove sections Yes No
Edit text & images Yes No
Create entirely new section types No Yes
Show/hide elements based on conditions No Yes
Display metafield data on product pages No Yes
Custom price formatting No Yes
Dynamic inventory badges No Yes
Custom cart modifications No Yes
Performance optimization No Yes
Multi-template product pages Yes Yes

The original article includes an interactive radar chart comparing theme-editor reach against Liquid across capability dimensions. Try the interactive version on the original post.

The rule of thumb: for most stores, the theme editor plus a well-chosen Shopify theme covers roughly 80% of what you need. The remaining 20% — unique sections, conditional logic, metafield-driven content — is where Liquid comes in. Do not reach for Liquid until you have exhausted what the editor can do.

What You Can Do with Liquid

These are the most common real-world use cases where stores reach for Liquid customizations:

  • Custom sections — build unique page sections (testimonials, product tabs, size guides) that merchants can add, configure, and reorder through the theme editor.
  • Conditional product logic — show "Low Stock" badges when inventory drops below a threshold, display "Pre-Order" buttons for upcoming products, or hide prices for logged-out visitors.
  • Dynamic content — pull metafield data into product pages (care instructions, size charts, ingredient lists) without installing apps.
  • Multi-currency / language — display localized content, format prices for different markets, and show region-specific shipping information.
  • Performance optimization — lazy-load images, conditionally load scripts, preload critical assets, and minimize DOM elements for faster page loads.
  • Custom cart & checkout — add gift wrapping options, delivery date pickers, upsell blocks, and free-shipping progress bars to the cart page.

Each of these can typically be implemented in 2–8 hours depending on complexity.

Real Liquid Code Examples

You do not need to understand every line — the point of these examples is to show what is possible and give you a concrete starting point. All examples follow Shopify's theme development documentation.

1. Low Stock Badge

Shows a "Low Stock" badge when inventory drops below a threshold. Uses Liquid objects to access inventory data:

{% if product.selected_or_first_available_variant.inventory_quantity <= 5
    and product.selected_or_first_available_variant.inventory_quantity > 0 %}
  <span class="badge badge--low-stock">
    Only {{ product.selected_or_first_available_variant.inventory_quantity }} left
  </span>
{% endif %}
Enter fullscreen mode Exit fullscreen mode

2. Metafield Content on a Product Page

Pulls custom data (like care instructions) from a product metafield:

{% assign care = product.metafields.custom.care_instructions %}
{% if care != blank %}
  <div class="care-instructions">
    <h3>Care Instructions</h3>
    <p>{{ care.value }}</p>
  </div>
{% endif %}
Enter fullscreen mode Exit fullscreen mode

3. Free Shipping Progress Bar

Displays how much more the customer needs to spend for free shipping. Uses Liquid filters for math and currency formatting:

{% assign threshold = 7500 %}  {%- comment -%} $75.00 in cents {%- endcomment -%}
{% assign remaining = threshold | minus: cart.total_price %}

{% if remaining > 0 %}
  <p>Add {{ remaining | money }} more for free shipping!</p>
  {% assign progress = cart.total_price | times: 100 | divided_by: threshold %}
  <div class="progress-bar">
    <div class="progress-bar__fill" style="width: {{ progress }}%"></div>
  </div>
{% else %}
  <p>You qualify for free shipping!</p>
{% endif %}
Enter fullscreen mode Exit fullscreen mode

4. Custom Section with Schema Settings

A reusable section where merchants configure content through the theme editor using schema settings:

<section class="announcement-bar" style="background: {{ section.settings.bg_color }}">
  <p>{{ section.settings.text }}</p>
</section>

{% schema %}
{
  "name": "Announcement Bar",
  "settings": [
    { "type": "text", "id": "text", "label": "Message", "default": "Free shipping on orders over $75" },
    { "type": "color", "id": "bg_color", "label": "Background Color", "default": "#000000" }
  ]
}
{% endschema %}
Enter fullscreen mode Exit fullscreen mode

5. Collection-Based Product Tabs

Dynamically generates product tabs based on a collection handle using Liquid tags for looping:

{% for collection in section.settings.collections %}
  <div class="tab-content" data-tab="{{ collection.handle }}">
    {% for product in collection.products limit: 8 %}
      <a href="{{ product.url }}">
        <img src="{{ product.featured_image | image_url: width: 400 }}"
             alt="{{ product.title }}" loading="lazy" />
        <h4>{{ product.title }}</h4>
        <p>{{ product.price | money }}</p>
      </a>
    {% endfor %}
  </div>
{% endfor %}
Enter fullscreen mode Exit fullscreen mode

Shopify maintains an official Liquid Cheat Sheet with a searchable reference of every object, tag, and filter. Bookmark it.

Hiring a Liquid Developer: Costs and What to Expect

If Liquid work is best left to a professional, here is what the market looks like: freelancers charge roughly $25–$150/hour, agencies $100–$250/hour, and a small task typically turns around in 2–5 days.

Task Cost range Timeline
Add a banner or announcement bar $150–$300 1–2 days
Custom product section $300–$800 2–4 days
Cart page customization $500–$1,500 3–5 days
Mega navigation menu $400–$1,000 2–4 days
Product page redesign $800–$2,500 5–10 days
Full custom theme $3,000–$15,000+ 4–12 weeks

The original post includes an interactive chart of these cost ranges by task type. Try the interactive version on the original article.

Where to find Liquid developers: the Shopify Partner Directory lists vetted agencies and freelancers. For a deeper breakdown of pricing, contracts, and red flags, see the guide to hiring a Shopify developer.

A word of caution when vetting: not all "Shopify developers" know Liquid well. Ask to see theme work specifically — not just Shopify app development, which uses React/Node rather than Liquid. Request a code sample or a link to a live store they have customized. A competent Liquid developer should know sections, blocks, schema settings, and Online Store 2.0 architecture.

Common Liquid Mistakes to Avoid

Whether you are writing Liquid yourself or managing a developer, these five mistakes cause the most damage — and they are all preventable:

  1. Editing the live theme directly. Always duplicate your theme before making Liquid changes. One syntax error can break the entire storefront for every visitor.
  2. Not using Shopify CLI for local development. Editing code in the browser admin is slow and error-prone. Use the Shopify CLI with hot reload for real-time previews and version control.
  3. Hardcoding values instead of using settings. Do not hardcode colors, text, or URLs. Use section schema settings so merchants can update content through the theme editor.
  4. Ignoring Liquid's sandboxed nature. Liquid cannot access external APIs, write to databases, or execute arbitrary Ruby. For backend logic, use Shopify Functions or custom apps.
  5. Over-customizing a theme you might replace. Heavy Liquid customizations do not transfer between themes. If you plan to switch themes within a year, keep customizations minimal or build reusable snippets.

The Bottom Line

Liquid is the invisible engine behind every Shopify storefront. It has been in production since 2006, it is open-source, and it is not being replaced anytime soon. For a business, the practical question is not "should I learn Liquid?" — it is "do I need Liquid-level customizations, and if so, should I hire a developer or learn the basics myself?"

If you are still picking a starting theme, the guide to Shopify themes covers what is editable without code, and the custom design playbook walks through when Liquid work is genuinely needed. Where to go next depends on your role:

  • Store owner — start with the theme editor; hire a developer only for specific Liquid tasks.
  • Want to learn — start with the Liquid basics docs, then practice editing the current flagship theme, Horizon, in a development store.
  • Need a developer — find a vetted Liquid expert through the Shopify Partner Directory.

Whether you are customizing the Horizon theme or building from scratch, Liquid gives Shopify the flexibility to match any brand's vision — without sacrificing the platform's security and reliability.

FAQ

What is Shopify Liquid in simple terms?
Liquid is the template language Shopify uses to display dynamic content on your online store. It acts as a bridge between your store's data (products, collections, customer info) and the HTML that visitors see in the browser — a set of instructions that tell Shopify what information to show and how to format it.

Do I need to know Liquid to run a Shopify store?
No. Most store owners never touch Liquid code. Shopify's theme editor lets you customize colors, fonts, layouts, and page content without any coding. Liquid becomes relevant only when you need customizations the editor does not support — like conditional product badges, custom sections, or dynamic content based on metafields.

Is Liquid a programming language?
Liquid is technically a template language, not a full programming language. It can output data and control what appears on a page (loops, conditionals), but it cannot access databases directly, make API calls, or perform complex computations. It is intentionally limited for security — it runs in a sandbox, so broken Liquid code cannot crash the server or expose sensitive data.

What is the difference between Liquid and HTML/CSS?
HTML defines the structure of a page (headings, paragraphs, divs). CSS styles it (colors, fonts, spacing). Liquid is the layer on top that inserts dynamic data into that HTML — product titles, prices, cart contents, collection names. A Shopify theme file typically contains all three.

Can Liquid code break my Shopify store?
Liquid runs in a sandboxed environment, so it cannot crash Shopify's servers or corrupt your data. However, incorrect Liquid code can break your store's visual appearance — showing wrong prices, hiding products, breaking mobile layouts, or creating infinite loops that slow down pages. Always test changes on a duplicate theme before publishing.

How long does it take to learn Shopify Liquid?
Basic Liquid (reading objects, simple conditionals, filters) can be understood in a few hours with Shopify's documentation. Building functional sections and snippets takes 2–4 weeks of practice. Advanced Liquid (complex metafield logic, performance optimization, custom schema settings) takes 2–3 months of hands-on work with real store projects.

What is the difference between Liquid and Shopify's theme editor?
The theme editor is a visual, no-code interface for customizing your store. Liquid is the underlying code that powers the theme. The editor exposes settings that theme developers defined using Liquid's schema system. When you change a color in the editor, you are updating a value that Liquid code reads and applies.

Can I use JavaScript with Liquid?
Yes. Shopify themes commonly combine Liquid and JavaScript. Liquid renders the initial HTML with dynamic data, and JavaScript adds interactivity (dropdown menus, image sliders, AJAX cart updates). You can also pass Liquid data to JavaScript variables using the json filter.

How much does a Liquid developer charge?
Shopify Liquid developers typically charge $25–$150/hour depending on experience and location. Simple tasks (adding a banner, modifying a section) cost $150–$500. Medium complexity work (custom sections, conditional logic) runs $500–$2,000. Complex projects (full custom theme builds) range from $3,000–$15,000+. Freelancers are generally 30–50% cheaper than agencies.

Is Liquid used outside of Shopify?
Yes. Liquid is open-source and used by other platforms including Jekyll (GitHub Pages), Zendesk, Salesforce, and many other web applications. However, Shopify's implementation includes Shopify-specific objects (product, collection, cart) that do not exist in the standard Liquid library. The syntax transfers between platforms; the available objects differ.


Originally published at shopify.ecom-store.pro, where the article includes interactive charts and an embedded video tutorial.

Written by Alexander Matynian, a front-end developer specializing in Shopify since 2017 — building custom Liquid themes, optimizing storefront performance, and integrating third-party apps. More e-commerce guides at shopify.ecom-store.pro.

Disclosure: this article was created with the help of AI.

Top comments (0)