技能 产品商业 Shopify订单与客户管理

Shopify订单与客户管理

v20260423
shopify-core-workflow-b
这是一个全面的核心工作流,用于管理Shopify的整个电商生命周期。它利用GraphQL Admin API来查询订单数据、处理订单履行(包含追踪信息)、创建草稿订单,以及高效地搜索和管理客户记录。适用于构建复杂的订单管理系统和电商集成。
获取技能
235 次下载
概览

Shopify Orders & Customer Management

Overview

Secondary core workflow: manage orders, customers, and fulfillments. Query order data, process fulfillments, and handle customer records through the GraphQL Admin API.

Prerequisites

  • Completed shopify-install-auth setup
  • Access scopes: read_orders, write_orders, read_customers, write_customers, read_fulfillments, write_fulfillments
  • Familiarity with shopify-core-workflow-a (products)

Instructions

Step 1: Query Orders

Query orders with financial/fulfillment status filters, line items, customer data, and shipping addresses. Uses Shopify query syntax (financial_status:paid, fulfillment_status:unfulfilled, name:#1001, etc.).

See Query Orders for the complete query with pagination and query syntax examples.

Step 2: Create a Draft Order

Create draft orders with variant line items, custom line items, discounts, shipping addresses, and customer assignment.

See Draft Order Create for the complete mutation and variables.

Step 3: Process Fulfillment

Two-step process: first query fulfillment orders for an order to get line item IDs, then create the fulfillment with tracking information and customer notification.

See Fulfillment Processing for both queries and the complete workflow.

Step 4: Customer Management

Search customers by email, order count, total spent, tags, and state. Returns addresses and metafields.

See Customer Search Query for the complete query and syntax examples.

Output

  • Orders queryable with financial and fulfillment status filters
  • Draft orders created with line items, discounts, and shipping
  • Fulfillments processed with tracking information
  • Customer records searchable with spending and order filters

Error Handling

ErrorCauseSolution
Access denied for ordersMissing read_orders scopeAdd scope and re-auth
Fulfillment order not foundWrong fulfillment order IDQuery fulfillment orders first
Cannot fulfill: already fulfilledOrder already shippedCheck remainingQuantity > 0
Customer not foundInvalid customer GIDVerify GID format gid://shopify/Customer/1234567890 (numeric ID)
Order is not editableOrder already archivedOnly draft/open orders are editable
THROTTLEDRate limit exceededImplement backoff -- see shopify-rate-limits

Examples

Order Analytics Query

// Get order count and revenue for a date range
const ORDER_ANALYTICS = `
  query orderAnalytics {
    ordersCount(query: "created_at:>2024-01-01 AND created_at:<2024-02-01") {
      count
    }
    orders(first: 1, query: "created_at:>2024-01-01", sortKey: TOTAL_PRICE, reverse: true) {
      edges {
        node {
          name
          totalPriceSet { shopMoney { amount currencyCode } }
        }
      }
    }
  }
`;

Refund an Order

Create a refund with line item restock and customer notification.

See Refund Create for the complete mutation and variables.

Resources

信息
分类 产品商业
名称 shopify-core-workflow-b
版本 v20260423
大小 5.42KB
更新时间 2026-09-06
语言