shopify-graphql

Shopify GraphQL Node for n8n

Package Information

Downloads: 20 weekly / 104 monthly
Latest Version: 0.1.11
Author: Markus Tripp

Documentation

n8n-nodes-shopify-graphql

A custom n8n community node for performing Shopify GraqhQL Queries and bulk operations directly within your workflows.

With this node, you can manage any Shopify Admin resource — such as products, inventory, metafields, and store settings — through a native, code-free n8n interface.

It also supports Shopify Bulk Operations, allowing you to perform large-scale data operations asynchronously, without worrying about pagination or rate limits.

🎥 Check out my YouTube video guides:

n8n is a fair-code licensed workflow automation platform.

Installation

Follow the installation guide in the n8n community nodes documentation.

Operations

Credentials

This node uses the same credentials as the built-in Shopify integration in n8n.

To set them up, follow the instructions here:

👉 Shopify Credential Setup

Once configured, all your Shopify nodes (REST or GraphQL) can share these credentials.

Compatibility

  • Tested with n8n version 1.113+
  • Written in TypeScript
  • Compatible with both cloud and self-hosted n8n instances

Usage

Shopify GraphQL

Shopify provides two APIs to interact with store data:

  1. Admin REST API (Deprecated)
  2. Admin GraqhQL API (Recommended)

The GraphQL API is the recommended choice — it gives access to all store data and new platform features, while the REST API is no longer updated.

You can quickly prototype your queries using the Shopify GraphQL Explorer.

shopify-graphql-explorer

Once you have a working query, copy the GraphQL code into the Shopify GraphQL node in n8n.

n8n-shopify-graphql

Shopify Bulk Query

The standard GraphQL API requires pagination when working with large datasets. For example, you can’t fetch all products or variants in one call.

Additionally, rate-limiting applies to standard queries.

Bulk operations solve this by letting you run large queries asynchronously on Shopify’s servers. Once complete, Shopify provides a download URL to retrieve the results.

This node provides a simple interface to trigger and handle these bulk operations from n8n.

n8n-shopify-bulk

[!NOTE]
Fetching 5,000 products using a bulk query took only 7 seconds. The result is returned in JSONL format — which is line-delimited JSON — making it easy to handle large datasets efficiently. You can also enable the Hierarchy option to automatically reconstruct parent–child relationships in the result.

Shopify Bulk Mutation

Bulk Mutations allow you to create or update thousands of resources (e.g., products, inventory items, metafields) with one operation.

These mutations usually involve:

  1. Preparing a .jsonl input file
  2. Uploading it to Shopify
  3. Executing the mutation referencing the uploaded file
  4. Waiting for Shopify to finalize the bulk job
n8n-shopify-bulk-mutation

[!NOTE]
Example: You can use Shopify’s productSet mutation to create or update products in bulk depending on whether the ID or handle exists.

Advanced Example: Update the Inventory of All Products Using Bulk Query and Mutation

This example demonstrates the full potential of Shopify Bulk Operations in n8n:

Workflow Overview

  1. Bulk Query: Fetch all products and variants
  2. Transformation: Increase stock quantity by 1
  3. Bulk Mutation: Push updated inventory back to Shopify

Total Execution Time: Fetch, transform, and update 5,242 products → ~12 minutes (726 seconds)

Step 1: Fetch All Products (Bulk Query)

n8n-shopify-bulk

When building queries, include __typename fields to maintain parent–child relationships when “hierarchy mode” is enabled in n8n.

query VideoBulkProducts {
	products {
		edges {
			node {
				id
				handle
				title
				totalInventory
				options {
					name
					values
				}
				__typename
				variants {
					edges {
						node {
							id
							title
							inventoryQuantity
							price
							__typename
							selectedOptions {
								name
								value
							}
							metafields {
								edges {
									node {
										id
										key
										value
										__typename
									}
								}
							}
						}
					}
				}
				metafields {
					edges {
						node {
							id
							key
							value
							__typename
						}
					}
				}
			}
		}
	}
}

Step 2: Prepare Bulk Mutation Input

Use the bulk mutation option to generate bulk input data:

n8n-shopify-bulk-mutation

Step 3: Execute Bulk Mutation in n8n

Finally, pass the generated .jsonl data into the Shopify Bulk Mutation node and execute the workflow to apply updates.

n8n-shopify-bulk-mutation-variables

Expression:

{
  "input": {
    "id": "{{ $json.id }}",
    "productOptions": {{ JSON.stringify($json.options?.map((option) => ({
      "name": option.name,
      "values": option.values.map((value) => ({
        "name": value
      }))
    })))}},
    "variants": {{ JSON.stringify($json.productVariants?.map((variant) => ({
        "optionValues": variant.selectedOptions?.map((option) => ({
          "optionName": option.name,
          "name": option.value
        })),
        "price": variant.price,
        "metafields": variant.metafields?.map((metafield) => ({
          "id": metafield.id,
          "key": metafield.key,
          "value": metafield.value
        })),
        "inventoryItem": {
          "tracked": true
        },
        "inventoryQuantities": [
          {
            "locationId": "gid://shopify/Location/1234567890",
            "name": "available",
            "quantity": variant.inventoryQuantity + 1
          }
        ]
      })))
    }}
  }
}

Shopify GraphQL Explorer for Prototyping

Before creating the n8n workflow, use the Shopify GraphQL Explorer to test your queries and mutations.

  1. Fetching Products:

n8n-graphql-inventory-query

  1. Updating Products:

n8n-graphql-inventory-mutation

Resources

Discussion