shopify-liquid
Write Shopify Liquid templates — objects, tags, filters, global objects, section schema, Online Store 2.0 JSON templates, and Liquid best practices. Use when customizing Shopify theme templates.
Best use case
shopify-liquid is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Write Shopify Liquid templates — objects, tags, filters, global objects, section schema, Online Store 2.0 JSON templates, and Liquid best practices. Use when customizing Shopify theme templates.
Teams using shopify-liquid should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/shopify-liquid/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How shopify-liquid Compares
| Feature / Agent | shopify-liquid | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Write Shopify Liquid templates — objects, tags, filters, global objects, section schema, Online Store 2.0 JSON templates, and Liquid best practices. Use when customizing Shopify theme templates.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Shopify Liquid Templating
## Before writing code
**Fetch live docs**:
1. Fetch `https://shopify.dev/docs/api/liquid` for Liquid reference
2. Web-search `site:shopify.dev liquid objects` for available objects
3. Web-search `site:shopify.dev liquid filters` for available filters
## What Is Liquid
Liquid is Shopify's template language:
- Ruby-based, open-source (created by Shopify)
- Renders on Shopify's servers — no client-side execution
- Three building blocks: **objects**, **tags**, **filters**
- Shopify extends standard Liquid with commerce-specific objects and filters
## Objects
Access data with double curly braces:
- `{{ product.title }}` — product name
- `{{ product.price | money }}` — formatted price
- `{{ cart.item_count }}` — number of items in cart
### Key Global Objects
| Object | Description |
|--------|-------------|
| `product` | Current product (on product pages) |
| `collection` | Current collection |
| `cart` | Shopping cart |
| `customer` | Logged-in customer (nil if guest) |
| `shop` | Store settings |
| `request` | Current request (locale, page type) |
| `content_for_header` | Required scripts/meta (must be in layout) |
| `content_for_layout` | Template content (must be in layout) |
| `all_products` | Access any product by handle |
| `collections` | All collections |
| `linklists` | Navigation menus |
| `pages` | CMS pages |
| `settings` | Theme settings |
## Tags
Control flow and logic:
### Control Flow
```liquid
{% if product.available %}
<span>In stock</span>
{% elsif product.variants.size > 0 %}
<span>Limited</span>
{% else %}
<span>Sold out</span>
{% endif %}
{% unless customer %}
<a href="/account/login">Log in</a>
{% endunless %}
{% case product.type %}
{% when 'Shirt' %}
<p>Clothing</p>
{% when 'Mug' %}
<p>Accessories</p>
{% endcase %}
```
### Iteration
```liquid
{% for product in collection.products %}
<h2>{{ product.title }}</h2>
{% endfor %}
{% for item in cart.items limit:5 offset:2 %}
{{ item.title }}
{% endfor %}
{% paginate collection.products by 12 %}
{% for product in collection.products %}
{{ product.title }}
{% endfor %}
{{ paginate | default_pagination }}
{% endpaginate %}
```
### Variable
```liquid
{% assign greeting = 'Hello' %}
{% capture full_greeting %}{{ greeting }}, {{ customer.first_name }}!{% endcapture %}
```
## Filters
Transform output:
- **String**: `upcase`, `downcase`, `strip`, `truncate`, `replace`, `split`, `url_encode`
- **Number**: `plus`, `minus`, `times`, `divided_by`, `round`, `ceil`, `floor`
- **Money**: `money`, `money_with_currency`, `money_without_trailing_zeros`
- **Date**: `date: '%B %d, %Y'`
- **Array**: `first`, `last`, `size`, `sort`, `map`, `where`, `join`, `uniq`
- **HTML**: `img_tag`, `script_tag`, `stylesheet_tag`
- **URL**: `asset_url`, `img_url`, `file_url`, `shopify_asset_url`
- **Media**: `image_url`, `image_tag` (modern replacements for `img_url`/`img_tag`)
## Section Schema
Sections define their own settings in a `{% schema %}` tag:
```liquid
{% schema %}
{
"name": "Featured Product",
"settings": [
{
"type": "product",
"id": "product",
"label": "Product"
},
{
"type": "color",
"id": "background_color",
"label": "Background color",
"default": "#ffffff"
}
],
"blocks": [
{
"type": "text",
"name": "Text block",
"settings": [
{
"type": "richtext",
"id": "content",
"label": "Content"
}
]
}
],
"presets": [
{
"name": "Featured Product"
}
]
}
{% endschema %}
```
## JSON Templates (Online Store 2.0)
Templates are JSON files that reference sections:
```json
{
"sections": {
"main": {
"type": "main-product",
"settings": {}
},
"recommendations": {
"type": "product-recommendations",
"settings": {
"heading": "You may also like"
}
}
},
"order": ["main", "recommendations"]
}
```
## Deprecated — Do NOT Reference
- **Timber** — deprecated starter theme; use Dawn instead
- Section-only themes without JSON templates (pre-Online Store 2.0)
## Best Practices
- Use `image_url` and `image_tag` instead of deprecated `img_url` / `img_tag`
- Use JSON templates for all page types (Online Store 2.0)
- Keep logic minimal — Liquid is a template language, not a programming language
- Use `{% comment %}` for documentation, not HTML comments (which are sent to the browser)
- Use snippets (`{% render 'snippet-name' %}`) for reusable code — `{% include %}` is deprecated
- Use `{% render %}` over `{% include %}` — render creates an isolated scope
- Apply `| escape` filter to user-generated content to prevent XSS
- Use section settings for merchant-configurable values instead of hardcoding
Fetch the Shopify Liquid reference for exact object properties, available filters, and section schema options before implementing.Related Skills
shopify-webhooks
Implement Shopify webhooks — subscription methods (HTTP, EventBridge, Pub/Sub, SQS), HMAC verification, mandatory GDPR webhooks, delivery methods, retry policy, and idempotency. Use when building event-driven Shopify integrations.
shopify-themes
Develop Shopify themes — file structure, Online Store 2.0, sections and blocks, settings schema, Dawn reference theme, Theme Check linting, asset pipeline, and theme deployment. Use when building or customizing Shopify themes.
shopify-testing
Test Shopify applications — app testing with Vitest and Playwright, theme testing with Theme Check, Function testing, webhook testing, extension testing, and CI/CD pipelines. Use when writing tests for Shopify projects.
shopify-setup
Set up a Shopify development environment — Shopify CLI installation, Partner account, development stores, environment variables, project structures for themes, apps, and Hydrogen. Use when starting a new Shopify project.
shopify-security
Secure Shopify applications — HMAC webhook verification, session token validation, OAuth scope management, Content Security Policy, GDPR mandatory webhooks, input validation, and secure coding practices. Use when implementing Shopify security features.
shopify-polaris
Build Shopify app UIs with Polaris — component categories, Web Components transition, React legacy components, App Design Guidelines, accessibility, @shopify/draggable, and design tokens. Use when building Shopify admin app interfaces.
shopify-performance
Optimize Shopify performance — Liquid rendering, asset optimization, CDN strategies, Core Web Vitals, Hydrogen caching, image optimization, preloading, and lazy loading. Use when improving Shopify store speed.
shopify-hydrogen
Build headless Shopify storefronts with Hydrogen — Remix-based framework, Oxygen deployment, storefront.query(), caching strategies, cart, customer accounts, SEO, and analytics. Use when building custom Shopify storefronts.
shopify-functions
Build Shopify Functions — serverless WebAssembly extensions for discounts, delivery customization, payment customization, cart validation, cart transforms, and order routing. Use when extending Shopify's backend logic.
shopify-customers
Manage Shopify customers — Customer Account API, new vs classic accounts, Multipass SSO, customer segmentation, B2B company accounts, metafields, and marketing consent. Use when working with Shopify customer data.
shopify-checkout-ui
Build Shopify checkout UI extensions — extension targets, UI primitives, Preact/Remote DOM rendering, checkout APIs, metafield access, post-purchase extensions, and thank-you page customization. Use when customizing Shopify checkout.
shopify-catalog
Manage Shopify catalog — Product, Variant, and Option models, collections, metafields and metaobjects, inventory management, product taxonomy, bulk operations, and media. Use when working with Shopify product data.