8
n8n 中文网amn8n.com

从 Airtable 创建 Shopify 产品

高级

这是一个CRM, Multimodal AI领域的自动化工作流,包含 16 个节点。主要使用 If, Graphql, Airtable, ManualTrigger, SplitInBatches 等节点。 在 Airtable 和 Shopify 之间同步产品及库存管理

前置要求
  • Airtable API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "V9bRm68MrWSvO1yP",
  "meta": {
    "instanceId": "eeebdb47cbe0bf5bc137514a863458fd2f9ab992b2ebeb2c6062100cdade81e7",
    "templateCredsSetupCompleted": true
  },
  "name": "从 Airtable 创建 Shopify 产品",
  "tags": [
    {
      "id": "vMF1giVsFs9aUam0",
      "name": "shopify",
      "createdAt": "2025-06-11T02:39:27.034Z",
      "updatedAt": "2025-06-11T02:39:27.034Z"
    },
    {
      "id": "SwBhawb0D4UB8meB",
      "name": "Airtable",
      "createdAt": "2025-08-16T00:46:42.425Z",
      "updatedAt": "2025-08-16T00:46:42.425Z"
    }
  ],
  "nodes": [
    {
      "id": "ab50e65d-a4b8-4b5c-b922-8187cf01b61f",
      "name": "启动工作流",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -544,
        32
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "2a664203-5fe5-4179-980d-e15c2c4b1ff0",
      "name": "Shopify, ProductQuery",
      "type": "n8n-nodes-base.graphql",
      "position": [
        544,
        48
      ],
      "parameters": {
        "query": "query Products ($handle: String! ) {\n    productByHandle(handle: $handle) {\n        id\n        title\n        variants(first:20) {\n            edges {\n                node {\n                    id\n                    title\n                    sku\n                    price \n                    inventoryItem {\n                        id\n                    }\n                }\n            }\n        }\n        updatedAt\n        createdAt\n    }\n}",
        "endpoint": "https://store99563.myshopify.com/admin/api/2025-04/graphql.json",
        "variables": "={\n    \"handle\" : \"{{ $json.slug }}\"\n}",
        "authentication": "headerAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "mHtpN3u5aCWsxWih",
          "name": "Shopify GraphQL Header Auth account"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "aa64b2fe-4ebe-4e56-89b3-cda00f2926d7",
      "name": "如果产品存在",
      "type": "n8n-nodes-base.if",
      "position": [
        752,
        48
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "81228bbc-7111-40ec-8b37-3c9878945c4d",
              "operator": {
                "type": "object",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.data.productByHandle }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "98a96cb6-1453-4dfb-b721-b8f7dabf7cc2",
      "name": "Shopify, CreateProduct",
      "type": "n8n-nodes-base.graphql",
      "position": [
        960,
        128
      ],
      "parameters": {
        "query": "mutation productCreate($product: ProductCreateInput!, $media: [CreateMediaInput!]) {\n  productCreate(product: $product, media: $media) {\n    product {\n     id\n      title\n      descriptionHtml\n      vendor\n      productType\n      status\n      handle\n      variants(first:10) {\n        edges {\n            node {\n                id\n                sku\n                displayName\n                inventoryItem {\n                    id\n                    sku\n                    tracked\n                    requiresShipping\n                }\n            }\n        }\n      }\n      media(first: 10) {\n        edges {\n            node {\n                alt\n                mediaContentType\n                status\n                id\n                preview {\n                    image {\n                        url\n                    }\n                    status\n                }\n            }\n        }\n      }\n      options {\n        id\n        name\n        position\n        optionValues {\n          id\n          name\n          hasVariants\n        }\n      }\n    }\n    userErrors {\n      field\n      message\n    }\n  }\n}",
        "endpoint": "https://store99563.myshopify.com/admin/api/2025-04/graphql.json",
        "variables": "={\n    \"product\": {\n        \"title\": \" {{ $('Loop').item.json.title }} \",\n        \"descriptionHtml\": \"{{ $('Loop').item.json.description }}\",\n        \"vendor\" : \"{{ $('Loop').item.json.company }}\",\n        \"productType\": \"{{ $('Loop').item.json.type }}\",\n        \"status\": \"{{ $('Loop').item.json.status }}\",\n        \"handle\": \"{{ $('Loop').item.json.slug }}\"\n    },\n    \"media\" : [{\n        \"alt\" : \"alt tag\",\n        \"mediaContentType\" : \"IMAGE\",\n        \"originalSource\" : \"https://placehold.co/800x600.png\"\n    }]\n}",
        "authentication": "headerAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "mHtpN3u5aCWsxWih",
          "name": "Shopify GraphQL Header Auth account"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "bd8608b9-5438-41dc-8ee2-9720714ecf70",
      "name": "Shopify, GetLocations",
      "type": "n8n-nodes-base.graphql",
      "position": [
        -288,
        32
      ],
      "parameters": {
        "query": "query {\n    locations(first:1, reverse:true) {\n        edges {\n            node {\n                id\n                name\n                address {\n                    address1\n                    address2\n                    city\n                    country\n                    zip\n                    province\n                }\n            }\n        }\n    }\n}",
        "endpoint": "https://store99563.myshopify.com/admin/api/2025-04/graphql.json",
        "authentication": "headerAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "mHtpN3u5aCWsxWih",
          "name": "Shopify GraphQL Header Auth account"
        }
      },
      "executeOnce": true,
      "typeVersion": 1.1
    },
    {
      "id": "fe00bde0-ba99-44c2-8059-f57e5ccede6f",
      "name": "已完成",
      "type": "n8n-nodes-base.noOp",
      "position": [
        480,
        -320
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "5bad3bd2-bdfc-43c1-a192-7a3956256efe",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -544,
        -688
      ],
      "parameters": {
        "width": 800,
        "height": 660,
        "content": "## 从 Airtable 在 Shopify 中创建产品"
      },
      "typeVersion": 1
    },
    {
      "id": "a05501e9-4c4d-4595-acc0-a77b27068561",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        480,
        -160
      ],
      "parameters": {
        "width": 1104,
        "height": 540,
        "content": "## Shopify, 根据需要更新或创建产品"
      },
      "typeVersion": 1
    },
    {
      "id": "278fc7f2-c724-467a-84aa-6a300b902cef",
      "name": "循环",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        240,
        32
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "af96fba0-33af-451e-9ba1-91363b4fea89",
      "name": "Shopify, UpdateProduct",
      "type": "n8n-nodes-base.graphql",
      "position": [
        960,
        -48
      ],
      "parameters": {
        "query": "mutation productUpdate($product: ProductUpdateInput, $media: [CreateMediaInput!]) {\n  productUpdate(product: $product, media: $media) {\n    product {\n        id\n        title\n        descriptionHtml\n        vendor\n        productType\n        status\n        handle\n        tracksInventory\n        variants(first:10) {\n            edges {\n                node {\n                    id\n                    sku\n                    displayName\n                    inventoryItem {\n                        id\n                        sku\n                        tracked\n                        requiresShipping\n                    }\n                }\n            }\n        }\n    }\n    userErrors {\n      field\n      message\n    }\n  }\n}",
        "endpoint": "https://store99563.myshopify.com/admin/api/2025-04/graphql.json",
        "variables": "={\n    \"product\": {\n        \"id\" : \"{{$('Shopify, ProductQuery').item.json.data.productByHandle.id}}\",\n        \"title\": \"{{ $('Loop').item.json.title }}\",\n        \"descriptionHtml\": \"{{ $('Loop').item.json.description }}\",\n        \"vendor\" : \"{{ $('Loop').item.json.company }}\",\n        \"productType\": \"{{ $('Loop').item.json.type }}\",\n        \"status\": \"{{ $('Loop').item.json.status }}\",\n        \"handle\": \"{{ $('Loop').item.json.slug }}\"\n    },\n    \"media\" : [{\n        \"alt\" : \"alt tag\",\n        \"mediaContentType\" : \"IMAGE\",\n        \"originalSource\" : \"https://placehold.co/800x600.png\"\n    }]\n}",
        "authentication": "headerAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "mHtpN3u5aCWsxWih",
          "name": "Shopify GraphQL Header Auth account"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "3188a91d-8f09-4a2a-8088-2ed831a5536c",
      "name": "Airtable, 标记记录为已同步",
      "type": "n8n-nodes-base.airtable",
      "position": [
        1632,
        128
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "appuC7ipYY6Ra7ENL",
          "cachedResultUrl": "https://airtable.com/appuC7ipYY6Ra7ENL",
          "cachedResultName": "Products"
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "tblG40vC9rIyMO3dt",
          "cachedResultUrl": "https://airtable.com/appuC7ipYY6Ra7ENL/tblG40vC9rIyMO3dt",
          "cachedResultName": "products"
        },
        "columns": {
          "value": {
            "id": "={{ $('Loop').item.json.id }}",
            "sync": false
          },
          "schema": [
            {
              "id": "id",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": true,
              "required": false,
              "displayName": "id",
              "defaultMatch": true
            },
            {
              "id": "title",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "description",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "description",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "company",
              "type": "options",
              "display": true,
              "options": [
                {
                  "name": "Burton",
                  "value": "Burton"
                },
                {
                  "name": "Capita",
                  "value": "Capita"
                },
                {
                  "name": "Jones",
                  "value": "Jones"
                },
                {
                  "name": "K2",
                  "value": "K2"
                },
                {
                  "name": "Roxy",
                  "value": "Roxy"
                },
                {
                  "name": "Union",
                  "value": "Union"
                },
                {
                  "name": "Flux",
                  "value": "Flux"
                },
                {
                  "name": "Salomon",
                  "value": "Salomon"
                },
                {
                  "name": "ThirtyTwo",
                  "value": "ThirtyTwo"
                },
                {
                  "name": "Vans",
                  "value": "Vans"
                },
                {
                  "name": "DC",
                  "value": "DC"
                },
                {
                  "name": "Smith",
                  "value": "Smith"
                },
                {
                  "name": "Giro",
                  "value": "Giro"
                },
                {
                  "name": "Anon",
                  "value": "Anon"
                },
                {
                  "name": "Oakley",
                  "value": "Oakley"
                },
                {
                  "name": "Dragon",
                  "value": "Dragon"
                },
                {
                  "name": "Volcom",
                  "value": "Volcom"
                },
                {
                  "name": "686",
                  "value": "686"
                },
                {
                  "name": "Patagonia",
                  "value": "Patagonia"
                },
                {
                  "name": "Smartwool",
                  "value": "Smartwool"
                },
                {
                  "name": "Mammut",
                  "value": "Mammut"
                },
                {
                  "name": "Dakine",
                  "value": "Dakine"
                },
                {
                  "name": "Outdoor Research",
                  "value": "Outdoor Research"
                },
                {
                  "name": "Hestra",
                  "value": "Hestra"
                },
                {
                  "name": "Darn Tough",
                  "value": "Darn Tough"
                },
                {
                  "name": "Stance",
                  "value": "Stance"
                },
                {
                  "name": "Buff",
                  "value": "Buff"
                },
                {
                  "name": "POC",
                  "value": "POC"
                },
                {
                  "name": "G-Form",
                  "value": "G-Form"
                },
                {
                  "name": "Swix",
                  "value": "Swix"
                },
                {
                  "name": "Toko",
                  "value": "Toko"
                },
                {
                  "name": "Black Diamond",
                  "value": "Black Diamond"
                },
                {
                  "name": "Various",
                  "value": "Various"
                },
                {
                  "name": "GoPro",
                  "value": "GoPro"
                },
                {
                  "name": "ThermaCELL",
                  "value": "ThermaCELL"
                },
                {
                  "name": "Anker",
                  "value": "Anker"
                },
                {
                  "name": "Motorola",
                  "value": "Motorola"
                },
                {
                  "name": "HotHands",
                  "value": "HotHands"
                },
                {
                  "name": "Store",
                  "value": "Store"
                },
                {
                  "name": "Snowboard Mag",
                  "value": "Snowboard Mag"
                },
                {
                  "name": "Midland",
                  "value": "Midland"
                },
                {
                  "name": "Snowboard Addiction",
                  "value": "Snowboard Addiction"
                },
                {
                  "name": "Mountain Hardware",
                  "value": "Mountain Hardware"
                },
                {
                  "name": "Subzero",
                  "value": "Subzero"
                },
                {
                  "name": "Peerless",
                  "value": "Peerless"
                },
                {
                  "name": "AAA",
                  "value": "AAA"
                },
                {
                  "name": "Powder Publishing",
                  "value": "Powder Publishing"
                },
                {
                  "name": "Local Artist",
                  "value": "Local Artist"
                }
              ],
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "company",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "category",
              "type": "options",
              "display": true,
              "options": [
                {
                  "name": "Snowboards",
                  "value": "Snowboards"
                },
                {
                  "name": "Bindings",
                  "value": "Bindings"
                },
                {
                  "name": "Boots",
                  "value": "Boots"
                },
                {
                  "name": "Safety",
                  "value": "Safety"
                },
                {
                  "name": "Outerwear",
                  "value": "Outerwear"
                },
                {
                  "name": "Base Layers",
                  "value": "Base Layers"
                },
                {
                  "name": "Mid Layers",
                  "value": "Mid Layers"
                },
                {
                  "name": "Gloves & Mittens",
                  "value": "Gloves & Mittens"
                },
                {
                  "name": "Socks",
                  "value": "Socks"
                },
                {
                  "name": "Accessories",
                  "value": "Accessories"
                },
                {
                  "name": "Protection",
                  "value": "Protection"
                },
                {
                  "name": "Tools & Maintenance",
                  "value": "Tools & Maintenance"
                },
                {
                  "name": "Bags & Storage",
                  "value": "Bags & Storage"
                },
                {
                  "name": "Avalanche Safety",
                  "value": "Avalanche Safety"
                },
                {
                  "name": "Electronics",
                  "value": "Electronics"
                },
                {
                  "name": "Security",
                  "value": "Security"
                },
                {
                  "name": "Gift Cards",
                  "value": "Gift Cards"
                },
                {
                  "name": "Media",
                  "value": "Media"
                },
                {
                  "name": "Automotive",
                  "value": "Automotive"
                },
                {
                  "name": "Home Decor",
                  "value": "Home Decor"
                }
              ],
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "category",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "status",
              "type": "options",
              "display": true,
              "options": [
                {
                  "name": "DRAFT",
                  "value": "DRAFT"
                },
                {
                  "name": "ACTIVE",
                  "value": "ACTIVE"
                }
              ],
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "slug",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "slug",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "price",
              "type": "number",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "price",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "compare_at_price",
              "type": "number",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "compare_at_price",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sku",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "sku",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "stock_on_hand",
              "type": "number",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "stock_on_hand",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sync",
              "type": "boolean",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "sync",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "id"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update"
      },
      "credentials": {
        "airtableTokenApi": {
          "id": "URbMfHftlA8PQlaP",
          "name": "Airtable Personal Access Token account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "71f512fa-9ce1-4f19-a500-85bd53667c0e",
      "name": "Shopify, Update SetInventory",
      "type": "n8n-nodes-base.graphql",
      "position": [
        1392,
        -48
      ],
      "parameters": {
        "query": "mutation inventorySetOnHandQuantities($input: InventorySetOnHandQuantitiesInput!) {\n    inventorySetOnHandQuantities(input: $input) {\n        userErrors {\n            field\n            message\n        }\n    }\n}",
        "endpoint": "=https://store99563.myshopify.com/admin/api/2025-04/graphql.json",
        "variables": "={\n    \"input\" : {\n        \"reason\": \"correction\",\n        \"setQuantities\" :[{\n            \"inventoryItemId\":\"{{ $('Shopify, UpdateProduct').item.json.data.productUpdate.product.variants.edges[0].node.inventoryItem.id }}\",\n            \"locationId\": \"{{ $('Shopify, GetLocations').item.json.data.locations.edges[0].node.id }}\",\n            \"quantity\" : {{ $('Loop').item.json.stock_on_hand }}\n        }]\n    }\n}",
        "authentication": "headerAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "mHtpN3u5aCWsxWih",
          "name": "Shopify GraphQL Header Auth account"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "bf40161f-36a2-4015-8eda-e1f8b6fef998",
      "name": "Shopify, Create SetInventory",
      "type": "n8n-nodes-base.graphql",
      "position": [
        1392,
        128
      ],
      "parameters": {
        "query": "mutation inventorySetOnHandQuantities($input: InventorySetOnHandQuantitiesInput!) {\n    inventorySetOnHandQuantities(input: $input) {\n        userErrors {\n            field\n            message\n        }\n    }\n}",
        "endpoint": "=https://store99563.myshopify.com/admin/api/2025-04/graphql.json",
        "variables": "={\n    \"input\" : {\n        \"reason\": \"correction\",\n        \"setQuantities\" :[{\n            \"inventoryItemId\":\"{{ $('Shopify, CreateProduct').item.json.data.productCreate.product.variants.edges[0].node.inventoryItem.id }}\",\n            \"locationId\": \"{{ $('Shopify, GetLocations').item.json.data.locations.edges[0].node.id }}\",\n            \"quantity\" : {{ $('Loop').item.json.stock_on_hand }}\n        }]\n    }\n}",
        "authentication": "headerAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "mHtpN3u5aCWsxWih",
          "name": "Shopify GraphQL Header Auth account"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "339262c5-5759-4ab8-a2f1-b83752ae2d5d",
      "name": "Airtable, FetchRecords",
      "type": "n8n-nodes-base.airtable",
      "position": [
        -48,
        32
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "appuC7ipYY6Ra7ENL",
          "cachedResultUrl": "https://airtable.com/appuC7ipYY6Ra7ENL",
          "cachedResultName": "Products"
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "tblG40vC9rIyMO3dt",
          "cachedResultUrl": "https://airtable.com/appuC7ipYY6Ra7ENL/tblG40vC9rIyMO3dt",
          "cachedResultName": "products"
        },
        "options": {
          "fields": [
            "title",
            "description",
            "company",
            "status",
            "slug",
            "price",
            "compare_at_price",
            "sku",
            "stock_on_hand",
            "type"
          ]
        },
        "operation": "search",
        "filterByFormula": "sync"
      },
      "credentials": {
        "airtableTokenApi": {
          "id": "URbMfHftlA8PQlaP",
          "name": "Airtable Personal Access Token account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "9a15b62f-702f-408b-bee2-9fed5fdb2b90",
      "name": "Shopify, Update SetVariant",
      "type": "n8n-nodes-base.graphql",
      "position": [
        1184,
        -48
      ],
      "parameters": {
        "query": "mutation productVariantsBulkUpdate($productId: ID!, $variants: [ProductVariantsBulkInput!]!) {\n    productVariantsBulkUpdate(productId: $productId, variants: $variants) {\n        product {\n            id\n            handle\n        }\n        productVariants {\n            id\n            sku\n            title\n            price\n            compareAtPrice\n        }\n        userErrors {\n            field\n            message\n        }\n    }\n}",
        "endpoint": "https://store99563.myshopify.com/admin/api/2025-04/graphql.json",
        "variables": "={\n    \"productId\": \"{{ $json.data.productUpdate.product.id }}\",\n    \"variants\": {\n        \"id\" : \"{{ $json.data.productUpdate.product.variants.edges[0].node.id }}\",\n        \"price\" : \"{{ $('Loop').item.json.price }}\",\n        \"compareAtPrice\": \"{{ $('Loop').item.json.compare_at_price }}\",\n        \"inventoryItem\": {\n            \"sku\": \"{{ $('Loop').item.json.sku }}\",\n            \"tracked\": true,\n            \"requiresShipping\": true\n        }\n    }\n}",
        "authentication": "headerAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "mHtpN3u5aCWsxWih",
          "name": "Shopify GraphQL Header Auth account"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "9eee917e-ecfa-4e87-9a64-8da674d5f2ce",
      "name": "Shopify, Create SetVariant",
      "type": "n8n-nodes-base.graphql",
      "position": [
        1184,
        128
      ],
      "parameters": {
        "query": "mutation productVariantsBulkUpdate($productId: ID!, $variants: [ProductVariantsBulkInput!]!) {\n    productVariantsBulkUpdate(productId: $productId, variants: $variants) {\n        product {\n            id\n            handle\n        }\n        productVariants {\n            id\n            sku\n            title\n            price\n            compareAtPrice\n        }\n        userErrors {\n            field\n            message\n        }\n    }\n}",
        "endpoint": "https://store99563.myshopify.com/admin/api/2025-04/graphql.json",
        "variables": "={\n    \"productId\": \"{{ $json.data.productCreate.product.id }}\",\n    \"variants\": {\n        \"id\" : \"{{ $json.data.productCreate.product.variants.edges[0].node.id }}\",\n        \"price\" : \"{{ $('Loop').item.json.price }}\",\n        \"compareAtPrice\": \"{{ $('Loop').item.json.compare_at_price }}\",\n        \"inventoryItem\": {\n            \"sku\": \"{{ $('Loop').item.json.sku }}\",\n            \"tracked\": true\n        }\n    }\n}",
        "authentication": "headerAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "mHtpN3u5aCWsxWih",
          "name": "Shopify GraphQL Header Auth account"
        }
      },
      "typeVersion": 1.1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "040ca7f6-a55a-4828-907f-d43ad8e15d8f",
  "connections": {
    "Loop": {
      "main": [
        [
          {
            "node": "Finished",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Shopify, ProductQuery",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Start Workflow": {
      "main": [
        [
          {
            "node": "Shopify, GetLocations",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If product exists": {
      "main": [
        [
          {
            "node": "Shopify, UpdateProduct",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Shopify, CreateProduct",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Shopify, GetLocations": {
      "main": [
        [
          {
            "node": "Airtable, FetchRecords",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Shopify, ProductQuery": {
      "main": [
        [
          {
            "node": "If product exists",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Airtable, FetchRecords": {
      "main": [
        [
          {
            "node": "Loop",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Shopify, CreateProduct": {
      "main": [
        [
          {
            "node": "Shopify, Create SetVariant",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Shopify, UpdateProduct": {
      "main": [
        [
          {
            "node": "Shopify, Update SetVariant",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Shopify, Create SetVariant": {
      "main": [
        [
          {
            "node": "Shopify, Create SetInventory",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Shopify, Update SetVariant": {
      "main": [
        [
          {
            "node": "Shopify, Update SetInventory",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Shopify, Create SetInventory": {
      "main": [
        [
          {
            "node": "Airtable, MarkRecord as Sync'd",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Shopify, Update SetInventory": {
      "main": [
        [
          {
            "node": "Airtable, MarkRecord as Sync'd",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Airtable, MarkRecord as Sync'd": {
      "main": [
        [
          {
            "node": "Loop",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 客户关系管理, 多模态 AI

需要付费吗?

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

工作流信息
难度等级
高级
节点数量16
分类2
节点类型7
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

外部链接
在 n8n.io 查看

分享此工作流