8
n8n 中文网amn8n.com

Shopify 订单自动履行流程

中级

这是一个AI, IT Ops领域的自动化工作流,包含 13 个节点。主要使用 Set, Filter, Shopify, HttpRequest, ManualTrigger 等节点,结合人工智能技术实现智能自动化。 Shopify 订单自动履行流程

前置要求
  • Shopify Admin API 凭证
  • 可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "e634e668fe1fc93a75c4f2a7fc0dad807ca318b79654157eadb9578496acbc76",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "30da4d86-83ef-4226-ad2e-d73f531bd4ed",
      "name": "当点击\"测试工作流\"时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        0,
        100
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "bd57625d-03f2-48b3-94b5-2653214682eb",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        700,
        -280
      ],
      "parameters": {
        "height": 440,
        "content": "## 筛选待履行的订单 👇"
      },
      "typeVersion": 1
    },
    {
      "id": "5928c16f-b842-42e3-9c81-ac9b796d22ff",
      "name": "遍历项目",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        1060,
        0
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "4509fb4e-fed0-4424-94a2-55d1c56a5d5a",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1320,
        -180
      ],
      "parameters": {
        "height": 340,
        "content": "## 获取履行订单 👇"
      },
      "typeVersion": 1
    },
    {
      "id": "76e16b42-01a3-4c88-a64b-a408b4bb9f40",
      "name": "由 Github 模型提供支持",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        0,
        -160
      ],
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "1835c0d1-c7d3-4db6-b898-d604c8df7ad1",
      "name": "筛选订单",
      "type": "n8n-nodes-base.filter",
      "position": [
        760,
        0
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "3fdde26b-82ef-42f1-ba36-d4fe667f8866",
              "operator": {
                "type": "number",
                "operation": "gt"
              },
              "leftValue": "={{ (new Date().getTime() - new Date($json.created_at).getTime()) / (1000 * 60 * 60) }}\n",
              "rightValue": 24
            }
          ]
        },
        "looseTypeValidation": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "977c3b8d-e3a9-4146-bc4c-e06e67f26a9e",
      "name": "获取履行订单",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1380,
        20
      ],
      "parameters": {
        "url": "=https://{{ $('Set Global').item.json['store-id'] }}.myshopify.com/admin/api/2025-01/orders/{{ $json.id }}/fulfillment_orders.json",
        "options": {},
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "shopifyAccessTokenApi"
      },
      "credentials": {
        "shopifyAccessTokenApi": {
          "id": "vtyKGPLLdjc7MLea",
          "name": "Shopify Access Token account"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "cf4c99c4-882c-4706-9cb9-8c154549545b",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        240,
        -180
      ],
      "parameters": {
        "width": 232,
        "height": 346,
        "content": "## 编辑此节点 👇"
      },
      "typeVersion": 1
    },
    {
      "id": "3a33e89b-ecf5-4be1-b3e4-9c20c00c7c1c",
      "name": "设置全局变量",
      "type": "n8n-nodes-base.set",
      "position": [
        300,
        0
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "78289fb1-8a1a-46a2-973e-f5f2a7309993",
              "name": "store-id",
              "type": "string",
              "value": "{store-id}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "68dffeba-705c-42b5-851e-893964a51176",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1680,
        -180
      ],
      "parameters": {
        "width": 232,
        "height": 346,
        "content": "## 创建履行 👇"
      },
      "typeVersion": 1
    },
    {
      "id": "24137672-00d7-4fa0-9238-f2dca7900adf",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -440,
        -300
      ],
      "parameters": {
        "width": 372,
        "height": 546,
        "content": "## 使用 n8n 实现 Shopify 履行自动化"
      },
      "typeVersion": 1
    },
    {
      "id": "bfb340f2-1fb6-4be7-823a-d24d6d8361be",
      "name": "获取所有未履行订单",
      "type": "n8n-nodes-base.shopify",
      "position": [
        540,
        0
      ],
      "parameters": {
        "options": {
          "fulfillmentStatus": "unfulfilled"
        },
        "operation": "getAll",
        "returnAll": true,
        "authentication": "accessToken"
      },
      "credentials": {
        "shopifyAccessTokenApi": {
          "id": "vtyKGPLLdjc7MLea",
          "name": "Shopify Access Token account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "8350fcaf-1bf8-4af1-a716-816b19a4b892",
      "name": "将履行订单标记为已履行",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1740,
        20
      ],
      "parameters": {
        "url": "=https://{{ $('Set Global').item.json['store-id'] }}.myshopify.com/admin/api/2025-01/fulfillments.json",
        "method": "POST",
        "options": {},
        "jsonBody": "={\"fulfillment\":{\"line_items_by_fulfillment_order\":[{\"fulfillment_order_id\":{{ $json.fulfillment_orders[0].id }}}],\"notify_customer\":true}}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "shopifyAccessTokenApi"
      },
      "credentials": {
        "shopifyAccessTokenApi": {
          "id": "vtyKGPLLdjc7MLea",
          "name": "Shopify Access Token account"
        }
      },
      "typeVersion": 4.2
    }
  ],
  "pinData": {},
  "connections": {
    "Set Global": {
      "main": [
        [
          {
            "node": "Get all Unfulfilled orders",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Orders": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Get Fulfillment Orders",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Set Global",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Fulfillment Orders": {
      "main": [
        [
          {
            "node": "Mark fulfillment orders as fulfilled",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get all Unfulfilled orders": {
      "main": [
        [
          {
            "node": "Filter Orders",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Test workflow’": {
      "main": [
        [
          {
            "node": "Set Global",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mark fulfillment orders as fulfilled": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

中级 - 人工智能, IT 运维

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
中级
节点数量13
分类2
节点类型8
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

作者
bangank36

bangank36

@bangank36

Automation specialist with 10+ years of experience helping SME website owners streamline their workflows—specializing in Squarespace, Shopify, and WordPress. Book an initial consultation for custom n8n automation using my link.

外部链接
在 n8n.io 查看

分享此工作流