{
  "id": "1VFYPRbT3Rm0LI8B",
  "meta": {
    "instanceId": "eeebdb47cbe0bf5bc137514a863458fd2f9ab992b2ebeb2c6062100cdade81e7",
    "templateCredsSetupCompleted": true
  },
  "name": "Shopify Products by Cursor",
  "tags": [],
  "nodes": [
    {
      "id": "6afbcef7-96c0-46de-915f-e186c74c6d65",
      "name": "Start Workflow",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        0,
        -120
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "f845ead7-cf3d-4ab8-94ba-075763600875",
      "name": "Shopify, products",
      "type": "n8n-nodes-base.graphql",
      "position": [
        220,
        -120
      ],
      "parameters": {
        "query": "query ($pageSize: Int!, $cursor: String) {\n    products(first: $pageSize, after: $cursor) {\n        edges {\n            node {\n                id\n                title\n                handle\n                createdAt\n                updatedAt\n            }\n        }\n        pageInfo {\n            hasNextPage\n            endCursor\n        }\n    }\n}",
        "endpoint": "https://store99563.myshopify.com/admin/api/2025-04/graphql.json",
        "variables": "={\n    \"pageSize\": 5,\n    \"cursor\": {{ $if($json?.data?.products?.pageInfo?.hasNextPage !== undefined, \"\\\"\" + $json.data.products.pageInfo.endCursor + \"\\\"\", \"null\"); }}\n}",
        "authentication": "headerAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "credential-id",
          "name": "httpHeaderAuth Credential"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "67c4c2ff-e653-438c-8200-909ee0ad1dd4",
      "name": "hasMoreProducts",
      "type": "n8n-nodes-base.if",
      "position": [
        440,
        -120
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "a31f61a1-242c-418b-8e5a-ad878a439246",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.data.products.pageInfo.hasNextPage }}",
              "rightValue": "true"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "d3fef035-b854-49ac-ba22-7ed66444dda3",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -40,
        -360
      ],
      "parameters": {
        "width": 780,
        "height": 220,
        "content": "## Shopify GraphQL cursor loop\n\nMany Shopify GraphQL queries have the ability to return a cursor which you can loop over, however the N8N GraphQL node does not natively have the ability to fetch pages.  This simple 3 node workflow displays how to setup a cursor to fetch all items in a collection. \n\nNote : The pageSize in the \"Shopify, products\" node is set to 5 to illustrate how querying by cursor works. In production you would set this to a much larger value. Also, Update the Endpoint in GraphQL node to reflect your Shopify store."
      },
      "typeVersion": 1
    },
    {
      "id": "6bcd2224-c82b-4b3e-a0e0-773a4fffc166",
      "name": "Wait 1s",
      "type": "n8n-nodes-base.wait",
      "position": [
        660,
        0
      ],
      "webhookId": "d114eefe-36b8-49cf-bba8-596928fdfc67",
      "parameters": {
        "amount": 1
      },
      "typeVersion": 1.1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "5734f646-93c7-41bf-ba1f-3ebc95cacf9b",
  "connections": {
    "Wait 1s": {
      "main": [
        [
          {
            "node": "Shopify, products",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Start Workflow": {
      "main": [
        [
          {
            "node": "Shopify, products",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "hasMoreProducts": {
      "main": [
        [
          {
            "node": "Wait 1s",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Shopify, products": {
      "main": [
        [
          {
            "node": "hasMoreProducts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}