shopify
Build and customize Shopify stores — themes with Liquid, Storefront API, custom apps, and headless commerce with Hydrogen. Use when someone asks to "build a Shopify store", "Shopify theme", "Liquid templates", "Shopify API", "Shopify app", "headless Shopify", "Hydrogen storefront", "customize Shopify", "Shopify product management", or "e-commerce with Shopify". Covers Liquid templating, theme development, Storefront/Admin APIs, custom apps, checkout extensions, and Hydrogen (React-based headless).
What this skill does
# Shopify
## Overview
Shopify is the leading e-commerce platform — from simple stores to enterprise. Build custom themes with Liquid templating (no backend needed, employees can edit content through the admin panel), extend functionality with custom apps via the Admin and Storefront APIs, or go fully headless with Hydrogen (React/Remix). Covers the full spectrum: zero-code store setup, theme customization, API integrations, and custom headless storefronts.
## When to Use
- Building an online store (products, cart, checkout, payments)
- Customizing Shopify themes (layout, design, sections)
- Building custom functionality (apps, integrations, webhooks)
- Headless commerce (custom frontend, Shopify as backend)
- Staff-manageable stores where non-technical people update products and content
## Instructions
### Theme Development with Liquid
```bash
# Install Shopify CLI
npm install -g @shopify/cli @shopify/theme
shopify theme init my-theme
cd my-theme
shopify theme dev # Local development with hot reload
```
#### Theme Structure
```
my-theme/
├── layout/
│ └── theme.liquid # Main layout (wraps all pages)
├── templates/
│ ├── index.json # Homepage (JSON template)
│ ├── product.liquid # Product page
│ ├── collection.liquid # Collection page
│ ├── cart.liquid # Cart page
│ └── page.liquid # Generic page
├── sections/
│ ├── header.liquid # Header section (customizable in admin)
│ ├── hero-banner.liquid # Hero banner section
│ ├── featured-products.liquid
│ └── footer.liquid
├── snippets/
│ ├── product-card.liquid # Reusable product card
│ └── price.liquid # Price display with compare-at
├── assets/
│ ├── theme.css
│ └── theme.js
├── config/
│ └── settings_schema.json # Theme settings (colors, fonts, etc.)
└── locales/
└── en.default.json # Translations
```
#### Liquid Templates
```liquid
{% comment %} sections/hero-banner.liquid — Customizable hero section {% endcomment %}
{% comment %}
Staff can change the heading, text, image, and button
through the Shopify admin without touching code.
{% endcomment %}
<section class="hero" style="background-image: url('{{ section.settings.image | image_url: width: 1920 }}')">
<div class="hero__content">
<h1>{{ section.settings.heading }}</h1>
<p>{{ section.settings.text }}</p>
{% if section.settings.button_text != blank %}
<a href="{{ section.settings.button_link }}" class="btn">
{{ section.settings.button_text }}
</a>
{% endif %}
</div>
</section>
{% schema %}
{
"name": "Hero Banner",
"settings": [
{
"type": "image_picker",
"id": "image",
"label": "Background Image"
},
{
"type": "text",
"id": "heading",
"label": "Heading",
"default": "Welcome to our store"
},
{
"type": "richtext",
"id": "text",
"label": "Description"
},
{
"type": "text",
"id": "button_text",
"label": "Button Text"
},
{
"type": "url",
"id": "button_link",
"label": "Button Link"
}
],
"presets": [
{
"name": "Hero Banner"
}
]
}
{% endschema %}
```
```liquid
{% comment %} sections/featured-products.liquid — Dynamic product grid {% endcomment %}
<section class="featured-products">
<h2>{{ section.settings.title }}</h2>
<div class="product-grid">
{% for product in section.settings.collection.products limit: section.settings.limit %}
{% render 'product-card', product: product %}
{% endfor %}
</div>
</section>
{% schema %}
{
"name": "Featured Products",
"settings": [
{ "type": "text", "id": "title", "label": "Section Title", "default": "Featured Products" },
{ "type": "collection", "id": "collection", "label": "Collection" },
{ "type": "range", "id": "limit", "label": "Products to show", "min": 2, "max": 12, "step": 1, "default": 4 }
],
"presets": [{ "name": "Featured Products" }]
}
{% endschema %}
```
```liquid
{% comment %} snippets/product-card.liquid — Reusable product card {% endcomment %}
<div class="product-card">
<a href="{{ product.url }}">
<img
src="{{ product.featured_image | image_url: width: 400 }}"
alt="{{ product.featured_image.alt | escape }}"
loading="lazy"
width="400"
height="400"
>
<h3>{{ product.title }}</h3>
<div class="product-card__price">
{% if product.compare_at_price > product.price %}
<span class="price--sale">{{ product.price | money }}</span>
<span class="price--compare">{{ product.compare_at_price | money }}</span>
{% else %}
<span>{{ product.price | money }}</span>
{% endif %}
</div>
</a>
<button class="btn" data-product-id="{{ product.variants.first.id }}">
{% if product.available %}
Add to Cart
{% else %}
Sold Out
{% endif %}
</button>
</div>
```
#### Theme Settings (Staff-Editable)
```json
// config/settings_schema.json — Theme customization panel
[
{
"name": "Colors",
"settings": [
{ "type": "color", "id": "color_primary", "label": "Primary Color", "default": "#000000" },
{ "type": "color", "id": "color_secondary", "label": "Secondary Color", "default": "#333333" },
{ "type": "color", "id": "color_accent", "label": "Accent Color", "default": "#0066cc" }
]
},
{
"name": "Typography",
"settings": [
{ "type": "font_picker", "id": "font_heading", "label": "Heading Font", "default": "helvetica_n7" },
{ "type": "font_picker", "id": "font_body", "label": "Body Font", "default": "helvetica_n4" }
]
},
{
"name": "Social Media",
"settings": [
{ "type": "text", "id": "social_instagram", "label": "Instagram URL" },
{ "type": "text", "id": "social_facebook", "label": "Facebook URL" },
{ "type": "text", "id": "social_tiktok", "label": "TikTok URL" }
]
}
]
```
### Storefront API (Headless)
```typescript
// lib/shopify.ts — Query Shopify Storefront API
const SHOPIFY_DOMAIN = "my-store.myshopify.com";
const STOREFRONT_TOKEN = process.env.SHOPIFY_STOREFRONT_TOKEN;
async function shopifyQuery(query: string, variables?: Record<string, any>) {
const res = await fetch(`https://${SHOPIFY_DOMAIN}/api/2024-10/graphql.json`, {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-Shopify-Storefront-Access-Token": STOREFRONT_TOKEN!,
},
body: JSON.stringify({ query, variables }),
});
return res.json();
}
// Get products
const { data } = await shopifyQuery(`
query GetProducts($first: Int!) {
products(first: $first) {
edges {
node {
id
title
handle
priceRange {
minVariantPrice { amount currencyCode }
}
images(first: 1) {
edges { node { url altText } }
}
}
}
}
}
`, { first: 12 });
```
### Admin API (Backend/Apps)
```typescript
// admin/products.ts — Manage products via Admin API
const ADMIN_TOKEN = process.env.SHOPIFY_ADMIN_TOKEN;
async function adminQuery(query: string, variables?: Record<string, any>) {
const res = await fetch(`https://${SHOPIFY_DOMAIN}/admin/api/2024-10/graphql.json`, {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-Shopify-Access-Token": ADMIN_TOKEN!,
},
body: JSON.stringify({ query, variables }),
});
return res.json();
}
// Create a product
await adminQuery(`
mutation CreateProduct($input: ProductInput!) {
productCreate(input: $input) {
product { id title }
userErrors { field message }
}
}
`, {
input: {
title: "New Product",
bodyHtml: "<p>Product description</p>",
vendor: "My Brand",
productType: "Accessories",
tags: ["new", "featured"],
},
});
```
### Cart with JavaScript (Ajax API)
```javascript
// assets/theme.js — Cart functionality (no page reload)
asynRelated in Web Dev
generating-lwc-components
IncludedLightning Web Components with PICKLES methodology and 165-point scoring. Use this skill when the user creates or edits LWC components, builds wire service patterns, or writes Jest tests for LWC. TRIGGER when: user creates/edits LWC components, touches lwc/**/*.js, .html, .css, .js-meta.xml files, or asks about wire service, SLDS, or Jest LWC tests. DO NOT TRIGGER when: Apex classes (use generating-apex), Aura components, or Visualforce.
tanstack-query
IncludedManage server state in React with TanStack Query v5. Set up queries with useQuery, mutations with useMutation, configure QueryClient caching strategies, implement optimistic updates, and handle infinite scroll with useInfiniteQuery. Use when: setting up data fetching in React projects, migrating from v4 to v5, or fixing object syntax required errors, query callbacks removed issues, cacheTime renamed to gcTime, isPending vs isLoading confusion, keepPreviousData removed problems.
document-processor-api
IncludedProcess documents with Nutrient DWS. Use when the user wants to generate PDFs from HTML or URLs, convert Office/images/PDFs, assemble or split packets, OCR scans, extract text/tables/key-value pairs, redact PII, watermark, sign, fill forms, optimize PDFs, or produce compliance outputs like PDF/A or PDF/UA. Triggers include convert to PDF, merge these PDFs, OCR this scan, extract tables, redact PII, sign this PDF, make this PDF/A, or linearize for web delivery.
nutrient-document-processing
IncludedProcess documents with Nutrient DWS. Use when the user wants to generate PDFs from HTML or URLs, convert Office/images/PDFs, assemble or split packets, OCR scans, extract text/tables/key-value pairs, redact PII, watermark, sign, fill forms, optimize PDFs, or produce compliance outputs like PDF/A or PDF/UA. Triggers include convert to PDF, merge these PDFs, OCR this scan, extract tables, redact PII, sign this PDF, make this PDF/A, or linearize for web delivery.
tanstack-query
IncludedManage server state in React with TanStack Query v5. Covers useMutationState, simplified optimistic updates, throwOnError, network mode (offline/PWA), and infiniteQueryOptions. Use when setting up data fetching, fixing v4→v5 migration errors (object syntax, gcTime, isPending, keepPreviousData), or debugging SSR/hydration issues with streaming server components.
accelint-nextjs-best-practices
IncludedNext.js performance optimization and best practices. Use when writing Next.js code (App Router or Pages Router); implementing Server Components, Server Actions, or API routes; optimizing RSC serialization, data fetching, or server-side rendering; reviewing Next.js code for performance issues; fixing authentication in Server Actions; or implementing Suspense boundaries, parallel data fetching, or request deduplication.