Mastering Shopify Liquid: A Developer's Guide to Theme Customization
Dive deep into Shopify's Liquid templating language. Learn objects, filters, tags, and advanced techniques for building custom Shopify themes.
Liquid is the backbone of every Shopify theme. Created by Shopify's founders, it's a powerful templating language that sits between your store's data and the HTML presented to customers. Whether you're customizing an existing theme or building one from scratch, mastering Liquid is essential.
What is Liquid?
Liquid is a template language with three main building blocks:
- Objects — Access store data using double curly braces:
{{ product.title }} - Tags — Control flow logic using curly-percent:
{% if product.available %} - Filters — Transform output with pipes:
{{ product.price | money }}
Essential Liquid Objects
The most commonly used objects in Shopify themes:
- product — Access title, price, images, variants, and metafields
- collection — The current collection with products, title, and description
- cart — Cart contents, total price, item count
- customer — Logged-in customer data including orders and addresses
- shop — Store-level settings like name, currency, and domain
- settings — Theme Customizer settings defined in
settings_schema.json
Powerful Liquid Filters
Filters transform data before rendering. Some of the most useful:
| money— Format numbers as currency| img_url: '500x'— Generate image URLs at specific dimensions| date: '%B %d, %Y'— Format dates| json— Convert objects to JSON (great for JavaScript integration)| asset_url— Generate URLs for theme assets| split | first | last— String manipulation chains
Advanced Techniques
Metafields for Custom Data
Metafields let you store custom data on products, collections, and pages. Access them in Liquid with {{ product.metafields.custom.field_name.value }}.
Section Rendering API
Build dynamic sections that merchants can customize through the theme editor. Use {% schema %} blocks to define settings.
Predictive Search
Implement real-time search suggestions using Shopify's Predictive Search API combined with Liquid templates and JavaScript fetch calls.
Need a Custom Shopify Theme?
At Code Kaarigari, I build 100% custom Shopify themes using advanced Liquid techniques, optimized for speed and conversions. Let's build your custom theme.