Logo Shopify

Shopify

Cộng đồng
einverne
shopify

Guide for implementing Shopify apps, extensions, themes, and integrations using GraphQL/REST APIs, Shopify CLI, Polaris UI, and various extension types (Checkout, Admin, POS). Use when building Shopify apps, implementing checkout extensions, customizing admin interfaces, creating themes with Liquid, or integrating with Shopify's APIs.

Tổng quan

Nhà phát hànheinverne
Kho mãdotfiles
Tên kỹ năngshopify
Sao
121
Bản fork
24
Tệp đi kèm
4
Giấy phépGPL-3.0
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 4 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được einverne công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Shopify trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/einverne/dotfiles/tree/master/claude/skills/shopify
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/einverne/dotfiles.git /tmp/dotfiles
mkdir -p .claude/skills
cp -r /tmp/dotfiles/claude/skills/shopify .claude/skills/shopify
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Shopify trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Shopify ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Shopify với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Shopify Development

This skill provides comprehensive guidance for building on the Shopify platform, including apps, extensions, themes, and API integrations.

When to Use This Skill

Use this skill when you need to:

  • Build Shopify apps (public or custom)
  • Create checkout, admin, or POS UI extensions
  • Develop themes using Liquid templating
  • Integrate with Shopify APIs (GraphQL Admin API, REST API, Storefront API)
  • Implement Shopify Functions (discounts, payments, delivery, validation)
  • Build headless storefronts with Hydrogen
  • Configure webhooks and metafields
  • Use Shopify CLI for development workflows

Core Platform Components

1. Shopify CLI

Installation:

bash
npm install -g @shopify/cli@latest

Essential Commands:

  • shopify app init - Create new app
  • shopify app dev - Start local development server
  • shopify app deploy - Deploy app to Shopify
  • shopify app generate extension - Add extension to app
  • shopify theme dev - Preview theme locally
  • shopify theme pull/push - Sync theme files

For detailed CLI reference, see reference/cli-commands.md

2. GraphQL Admin API (Recommended)

Primary API for new development. Efficient, type-safe, flexible.

Endpoint:

https://{shop-name}.myshopify.com/admin/api/2025-01/graphql.json

Authentication:

javascript
headers: {
  'X-Shopify-Access-Token': 'your-access-token',
  'Content-Type': 'application/json'
}

Common Operations:

  • Query products, orders, customers, inventory
  • Create/update/delete resources via mutations
  • Bulk operations for large datasets
  • Real-time data with subscriptions

For comprehensive GraphQL reference, see reference/graphql-admin-api.md

3. REST Admin API (Maintenance Mode)

Use only for legacy systems. Shopify recommends GraphQL for all new development.

Base URL:

https://{shop-name}.myshopify.com/admin/api/2025-01/{resource}.json

Rate Limits:

  • Standard: 2 requests/second
  • Plus: 4 requests/second

4. UI Frameworks

Polaris (React)

Design system for consistent Shopify UI:

bash
npm install @shopify/polaris
Polaris Web Components

Framework-agnostic components:

html
<script src="https://cdn.shopify.com/shopifycloud/polaris.js"></script>

Extension Types

Checkout UI Extensions

Customize checkout experience with native-rendered components.

Generate:

bash
shopify app generate extension --type checkout_ui_extension

Configuration: shopify.extension.toml

Common Components: View, BlockStack, InlineLayout, Button, TextField, Checkbox, Banner

For detailed extension reference, see reference/ui-extensions.md

Admin UI Extensions

Extend Shopify admin interface.

Types:

  • App blocks (embedded in native pages)
  • App overlays (modal experiences)
  • Links (product/collection/order pages)

POS Extensions

Customize Point of Sale experience.

Types:

  • Smart Grid Tiles (quick access actions)
  • Modals (dialogs and forms)
  • Cart modifications (custom discounts/line items)

Post-Purchase Extensions

Upsell offers after checkout completion.

Target: purchase.thank-you.block.render

Customer Account UI Extensions

Customize post-purchase account pages.

Targets: Account overview, order status/index

Shopify Functions

Serverless backend customization running on Shopify infrastructure.

Function Types:

  • Discounts: Cart, product, shipping, order discounts
  • Payment customization: Hide/rename/reorder payment methods
  • Delivery customization: Custom shipping options
  • Order routing: Fulfillment location rules
  • Validation: Cart and checkout business rules
  • Fulfillment constraints: Bundle shipping rules

Languages: JavaScript, Rust, AssemblyScript

Generate:

bash
shopify app generate extension --type function

Theme Development

Liquid Templating

Core Concepts:

  • Objects: {{ product.title }} - Output dynamic content
  • Filters: {{ product.price | money }} - Transform data
  • Tags: {% if %} {% for %} {% case %} - Control flow

Common Objects:

  • product - Product data
  • collection - Collection data
  • cart - Shopping cart
  • customer - Customer account
  • shop - Store information

Architecture:

  • Layouts: Base templates
  • Templates: Page structures
  • Sections: Reusable content blocks (Online Store 2.0)
  • Snippets: Smaller components

Development:

bash
shopify theme dev    # Local preview
shopify theme pull   # Download from store
shopify theme push   # Upload to store

Authentication & Security

OAuth 2.0 Flow

For public apps accessing merchant stores:

  1. Redirect merchant to authorization URL
  2. Merchant approves access
  3. Receive authorization code
  4. Exchange code for access token
  5. Store token securely

Access Scopes

Request minimum permissions needed:

  • read_products - View products
  • write_products - Modify products
  • read_orders - View orders
  • write_orders - Modify orders

Full scope list: https://shopify.dev/api/usage/access-scopes

Session Tokens

For embedded apps in Shopify admin using App Bridge.

Webhooks

Real-time event notifications from Shopify.

Configuration: shopify.app.toml

Common Topics:

  • orders/create, orders/updated, orders/paid
  • products/create, products/update, products/delete
  • customers/create, customers/update
  • app/uninstalled

GDPR Mandatory Webhooks:

  • customers/data_request
  • customers/redact
  • shop/redact

Metafields

Custom data storage for extending Shopify resources.

Owners: Products, variants, customers, orders, collections, shop

Types: text, number, date, URL, JSON, file_reference

Access: Admin API, Storefront API, Liquid templates

Best Practices

Performance

  • Use GraphQL instead of REST for efficiency
  • Request only needed fields in queries
  • Implement pagination for large datasets
  • Use bulk operations for batch processing
  • Respect rate limits (cost-based for GraphQL)

User Experience

  • Follow Polaris design guidelines
  • Implement loading states
  • Provide clear error messages
  • Support keyboard navigation
  • Test across devices

Security

  • Store API credentials securely
  • Use environment variables for tokens
  • Implement webhook verification
  • Follow OAuth best practices
  • Request minimal access scopes

Code Quality

  • Use TypeScript for type safety
  • Write comprehensive error handling
  • Implement retry logic with exponential backoff
  • Log errors for debugging
  • Keep dependencies updated

Testing

  • Use development stores for testing
  • Test across different store plans
  • Verify webhook handling
  • Test app uninstall flow
  • Validate GDPR compliance

Development Workflow

  1. Initialize App:

    bash
    shopify app init
  2. Configure Access Scopes: Edit shopify.app.toml:

    toml
    [access_scopes]
    scopes = "read_products,write_products"
  3. Start Development Server:

    bash
    shopify app dev
  4. Generate Extensions:

    bash
    shopify app generate extension
  5. Test in Development Store: Install app on test store

  6. Deploy to Production:

    bash
    shopify app deploy

Common Patterns

Fetch Products (GraphQL)

graphql
query {
  products(first: 10) {
    edges {
      node {
        id
        title
        handle
        variants(first: 5) {
          edges {
            node {
              id
              price
              inventoryQuantity
            }
          }
        }
      }
    }
    pageInfo {
      hasNextPage
      endCursor
    }
  }
}

Create Product (GraphQL)

graphql
mutation {
  productCreate(input: {
    title: "New Product"
    productType: "Clothing"
    variants: [{
      price: "29.99"
      sku: "SKU123"
    }]
  }) {
    product {
      id
      title
    }
    userErrors {
      field
      message
    }
  }
}

Checkout Extension (React)

javascript
import { useState } from 'react';
import {
  render,
  BlockStack,
  TextField,
  Checkbox,
  useApi
} from '@shopify/ui-extensions-react/checkout';

function Extension() {
  const { extensionPoint } = useApi();
  const [checked, setChecked] = useState(false);

  return (
    <BlockStack>
      <TextField label="Gift Message" />
      <Checkbox checked={checked} onChange={setChecked}>
        This is a gift
      </Checkbox>
    </BlockStack>
  );
}

render('Checkout::Dynamic::Render', () => <Extension />);

Resources

Documentation

Tools

  • GraphiQL Explorer: Built into Shopify admin
  • Shopify CLI: Development workflow
  • Partner Dashboard: App management
  • Development stores: Free testing environments

Learning

  • Shopify Developer Changelog: API updates and deprecations
  • Built for Shopify: Quality program for apps
  • Community forums: Help and discussions

Reference Documentation

This skill includes detailed reference documentation:

Troubleshooting

Common Issues

Rate Limit Errors:

  • Monitor X-Shopify-Shop-Api-Call-Limit header
  • Implement exponential backoff
  • Use bulk operations for large datasets

Authentication Failures:

  • Verify access token is valid
  • Check required scopes are granted
  • Ensure OAuth flow completed correctly

Webhook Not Receiving Events:

  • Verify webhook URL is accessible
  • Check webhook signature validation
  • Review webhook logs in Partner Dashboard

Extension Not Appearing:

  • Verify extension target is correct
  • Check extension is published
  • Ensure app is installed on store

Version Management

Shopify uses quarterly API versioning (YYYY-MM format):

  • Current: 2025-01
  • Each version supported for 12 months
  • Test updates before quarterly releases
  • Use version-specific endpoints

App Distribution

Custom Apps

Single merchant installation, no review required.

Public Apps

App Store listing with Shopify review:

  • Follow app requirements
  • Complete Built for Shopify criteria
  • Define pricing model
  • Submit for review

Note: This skill covers the Shopify platform as of January 2025. Always refer to official Shopify documentation for the latest updates and API versions.

Tệp đi kèm

Khi kỹ năng đã được tải, mô hình có thể đọc các tệp này nếu cần. Các tệp này chỉ dùng để đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Shopify làm được gì?

Guide for implementing Shopify apps, extensions, themes, and integrations using GraphQL/REST APIs, Shopify CLI, Polaris UI, and various extension types (Checkout, Admin, POS). Use when building Shopify apps, implementing checkout extensions, customizing admin interfaces, creating themes with Liquid, or integrating with Shopify's APIs.

Vì sao nên dùng Shopify trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Shopify là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Shopify trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/einverne/dotfiles/tree/master/claude/skills/shopify. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm rồi cài đặt cả gói dưới dạng một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Shopify?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Shopify với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Shopify với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Shopify có miễn phí không?

Có. Kỹ năng này được einverne phát hành trên GitHub theo giấy phép GPL-3.0. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇