Shopify liquid

From OrcaQubits/agentic-commerce-skills-plugins · View interactive version

Shopify liquid is an AI agent skill from the GitHub repository OrcaQubits/agentic-commerce-skills-plugins. 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.

How to use this skill

Skill file

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:

Objects

Access data with double curly braces:

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

{% 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

{% 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

{% assign greeting = 'Hello' %}
{% capture full_greeting %}{{ greeting }}, {{ customer.first_name }}!{% endcapture %}

Filters

Transform output:

Section Schema

Sections define their own settings in a {% schema %} tag:

{% 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:

{
  "sections": {
    "main": {
      "type": "main-product",
      "settings": {}
    },
    "recommendations": {
      "type": "product-recommendations",
      "settings": {
        "heading": "You may also like"
      }
    }
  },
  "order": ["main", "recommendations"]
}

Deprecated — Do NOT Reference

Best Practices

Fetch the Shopify Liquid reference for exact object properties, available filters, and section schema options before implementing.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.