Skip to main content
Glama
liquid-overview.md3.38 kB
# Liquid Reference ## Overview Liquid is a template language developed by Shopify, available as an open-source project on GitHub and utilized by numerous organizations. This reference documents Liquid tags, filters, and objects available for constructing Shopify Themes. ## What is a Template Language? A template language enables developers to create a single template containing static content while dynamically inserting information based on context. For example, a product template can display standard attributes like images, titles, and prices while rendering different values depending on which product is being viewed. ## Variations of Liquid The Liquid variation documented here extends the open-source version for Shopify theme development, incorporating theme-specific tags, filters, and objects. Shopify also uses modified Liquid versions for: - Notification templates - Shopify Flow - Order printer templates - Packing slip templates ## Liquid Basics Liquid dynamically outputs objects and properties using six fundamental data types, with basic logical and comparison operators for use in tags. ### Key Concepts **Objects and Properties**: Accessed using dot notation. Double curly braces denote outputs: ```liquid {{ product.title }} ``` **Tags**: Define conditional logic and iterations using `{% %}` delimiters: ```liquid {% if product.available %} Price: $99.99 {% else %} Sorry, this product is sold out. {% endif %} ``` **Filters**: Modify output using the pipe character `|`. Multiple filters chain left to right: ```liquid {{ product.title | upcase | remove: 'HEALTH' }} ``` ## Defining Logic with Tags Liquid tags establish instructions for template behavior. "Tags are wrapped with curly brace percentage delimiters `{% %}`" and direct what the template executes. ### Tags with Parameters Some tags accept optional or required parameters. The `for` tag demonstrates this with a `limit` parameter: ```liquid {% assign numbers = '1,2,3,4,5' | split: ',' %} {% for item in numbers limit:2 -%} {{ item }} {% endfor %} ``` To nest multiple tags, use the `liquid` tag. ## Modifying Output with Filters Filters alter variable and object output using pipe syntax. The `upcase` filter demonstrates basic filtering: ```liquid {{ product.title | upcase }} ``` ### Filters with Parameters Many filters accept required or optional parameters that adjust behavior: ```liquid {{ product.title | remove: 'Health' }} ``` ### Chaining Filters Multiple filters apply sequentially from left to right, with each output feeding the next: ```liquid {{ product.title | upcase | remove: 'HEALTH' }} ``` ## Referencing Objects Liquid objects represent variables for building themes, including store resources, standard content, and functional elements supporting interactivity. ### Object Access Methods Objects are available through three mechanisms: - **Globally**: Accessible across most Liquid files (excluding checkout contexts) - **In templates**: Specific to certain templates and their sections - **Through parents**: Returned as properties of other objects ### Creating Variables Custom variables use tags like `assign` or `capture`, treated syntactically identical to objects: ```liquid {{ variable_name }} ``` ## Resources & Tools Complete documentation and interactive examples support Liquid development across Shopify themes.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/florinel-chis/shopify-liquid-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server