Workflow doesn't copy all products from the source store to the destination store

hi,

i have a workflow here where we want an automation of copying products from one shopify to another shopify store, however, the workflow only copies up to 3 products to the destination store even if the source store has 6 products all in all.

{
“meta”: {
“instanceId”: “63bedc4dfa8618b205589ef9c8a003968ec01fb80782197e45c6ba51a0a50da2”
},
“nodes”: [
{
“parameters”: {
“url”: “=https://dubai-merchandise-store.myshopify.com/admin/api/2025-01/products/count.json”,
“authentication”: “predefinedCredentialType”,
“nodeCredentialType”: “shopifyAccessTokenApi”,
“sendQuery”: true,
“queryParameters”: {
“parameters”: [
{
“name”: “limit”,
“value”: “100”
}
]
},
“options”: {
“response”: {
“response”: {
“fullResponse”: true
}
}
}
},
“id”: “df95a339-305b-4a62-a611-ceba3e88607e”,
“name”: “count how many products”,
“type”: “n8n-nodes-base.httpRequest”,
“typeVersion”: 4.2,
“position”: [
-2340,
1140
],
“credentials”: {
“shopifyAccessTokenApi”: {
“id”: “DmU2uqhqLN0rk3Nm”,
“name”: “Dubai Test Store”
}
}
},
{
“parameters”: {
“url”: “https://dubai-merchandise-store.myshopify.com/admin/api/2025-01/products.json”,
“authentication”: “predefinedCredentialType”,
“nodeCredentialType”: “shopifyAccessTokenApi”,
“sendQuery”: true,
“queryParameters”: {
“parameters”: [
{
“name”: “limit”,
“value”: “1”
}
]
},
“options”: {
“response”: {
“response”: {
“fullResponse”: true
}
}
}
},
“id”: “fc87a921-bfdb-425e-979d-798c1f59ebf5”,
“name”: “get product 1”,
“type”: “n8n-nodes-base.httpRequest”,
“typeVersion”: 4.2,
“position”: [
-2140,
1140
],
“credentials”: {
“shopifyAccessTokenApi”: {
“id”: “DmU2uqhqLN0rk3Nm”,
“name”: “Dubai Test Store”
}
}
},
{
“parameters”: {
“assignments”: {
“assignments”: [
{
“id”: “6214cc57-2793-4a1c-b924-e1afdcc15ed3”,
“name”: “link”,
“value”: “={{ $(‘get product 1’).item.json.headers.link }}”,
“type”: “string”
}
]
},
“options”: {}
},
“id”: “70c85b00-6a26-42ac-be2b-70c8215de8c0”,
“name”: “get link product 2”,
“type”: “n8n-nodes-base.set”,
“typeVersion”: 3.4,
“position”: [
-2140,
1360
]
},
{
“parameters”: {
“jsCode”: “const output = items.map(item => {\n // Ensure the input data exists and is a string\n const inputData = item.json.link || ‘’; // Access the "link" property dynamically, fallback to empty string if undefined\n\n // Remove HTML tags, brackets, "rel" attribute, and semicolons from the link\n const cleanedData = inputData.toString()\n .replace(/<([^>])>/g, ‘$1’) // Removes angle brackets while keeping their content\n .replace(/rel="[^"]"/g, ‘’) // Removes ‘rel="…"’\n .replace(/;/g, ‘’) // Removes all semicolons\n .trim(); // Remove any leading/trailing spaces\n\n // Return the cleaned link\n return {\n json: {\n link: cleanedData\n }\n };\n});\n\n// Return the final output\nreturn output;\n”
},
“id”: “d3fe7141-5c3c-48a0-931c-65aaa30739d1”,
“name”: “remove html on get link product 2”,
“type”: “n8n-nodes-base.code”,
“typeVersion”: 2,
“position”: [
-2340,
1800
]
},
{
“parameters”: {
“authentication”: “accessToken”,
“resource”: “product”,
“title”: “={{ $(‘get product 1’).item.json.body.products[0].title }}”,
“additionalFields”: {
“images”:
}
},
“id”: “87308233-5901-4b89-857b-0d7cbba1753b”,
“name”: “add product 1 to destination store”,
“type”: “n8n-nodes-base.shopify”,
“typeVersion”: 1,
“position”: [
-1960,
1140
],
“credentials”: {
“shopifyAccessTokenApi”: {
“id”: “O50mdyUSBq5y9XXW”,
“name”: “demostore120622”
}
}
},
{
“parameters”: {
“method”: “PUT”,
“url”: “=https://demostore120622.myshopify.com/admin/api/2025-01/variants/{{ $json.variants[0].id }}.json”,
“authentication”: “predefinedCredentialType”,
“nodeCredentialType”: “shopifyAccessTokenApi”,
“sendHeaders”: true,
“headerParameters”: {
“parameters”: [
{
“name”: “Content-Type”,
“value”: “application/json”
}
]
},
“sendBody”: true,
“specifyBody”: “json”,
“jsonBody”: “={\n "variant": {\n "id": "{{ $json.id }}",\n "price": "{{ $(‘get product 1’).item.json.body.products[0].variants[0].price }}",\n "compare_at_price": "{{ $(‘get product 1’).item.json.body.products[0].variants[0].compare_at_price }}",\n "sku": "{{ $(‘get product 1’).item.json.body.products[0].variants[0].sku }}"\n }\n}\n”,
“options”: {}
},
“id”: “fbf55a29-d837-4f56-866d-a0e7bc21afaf”,
“name”: “add product 1 price, compare at price and sku”,
“type”: “n8n-nodes-base.httpRequest”,
“typeVersion”: 4.2,
“position”: [
-2340,
1360
],
“credentials”: {
“shopifyApi”: {
“id”: “y8KSV5VjV2boGr6J”,
“name”: “Shopify account”
},
“shopifyAccessTokenApi”: {
“id”: “O50mdyUSBq5y9XXW”,
“name”: “demostore120622”
}
}
},
{
“parameters”: {
“authentication”: “accessToken”,
“resource”: “product”,
“title”: “={{ $json.body.products[0].title }}”,
“additionalFields”: {
“images”:
}
},
“id”: “b8ed25d5-c004-4e90-a851-c08c789c519d”,
“name”: “add product 2 to destination store”,
“type”: “n8n-nodes-base.shopify”,
“typeVersion”: 1,
“position”: [
-2340,
2040
],
“credentials”: {
“shopifyAccessTokenApi”: {
“id”: “O50mdyUSBq5y9XXW”,
“name”: “demostore120622”
}
}
},
{
“parameters”: {
“method”: “PUT”,
“url”: “=https://demostore120622.myshopify.com/admin/api/2025-01/variants/{{ $json.variants[0].id }}.json”,
“authentication”: “predefinedCredentialType”,
“nodeCredentialType”: “shopifyAccessTokenApi”,
“sendHeaders”: true,
“headerParameters”: {
“parameters”: [
{
“name”: “Content-Type”,
“value”: “application/json”
}
]
},
“sendBody”: true,
“specifyBody”: “json”,
“jsonBody”: “={\n "variant": {\n "id": "{{ $json.variants[0].id }}",\n "price": "{{ $json.variants[0].price }}",\n "compare_at_price": "{{ $json.variants[0].compare_at_price }}",\n "sku": "{{ $json.variants[0].sku }}"\n }\n}\n”,
“options”: {}
},
“id”: “dc30b6ad-4775-49bb-8eb8-6ecbb93adffd”,
“name”: “add product 2 price, compare at price and sku”,
“type”: “n8n-nodes-base.httpRequest”,
“typeVersion”: 4.2,
“position”: [
-2140,
2040
],
“credentials”: {
“shopifyApi”: {
“id”: “y8KSV5VjV2boGr6J”,
“name”: “Shopify account”
},
“shopifyAccessTokenApi”: {
“id”: “O50mdyUSBq5y9XXW”,
“name”: “demostore120622”
}
}
},
{
“parameters”: {
“conditions”: {
“options”: {
“caseSensitive”: true,
“leftValue”: “”,
“typeValidation”: “strict”
},
“conditions”: [
{
“id”: “187ae77c-12f0-4e3f-b811-1135230bf779”,
“leftValue”: “={{ $json.link }}”,
“rightValue”: “next”,
“operator”: {
“type”: “string”,
“operation”: “contains”
}
}
],
“combinator”: “and”
},
“options”: {}
},
“id”: “7754e252-2756-4775-adc7-231523d074cc”,
“name”: “does product link have next?”,
“type”: “n8n-nodes-base.if”,
“typeVersion”: 2.1,
“position”: [
-2240,
1600
]
},
{
“parameters”: {
“assignments”: {
“assignments”: [
{
“id”: “4974c811-6e7a-402a-b458-c9ca7b9cff9f”,
“name”: “link”,
“value”: “={{ $(‘get succeeding product’).item.json.headers.link }}”,
“type”: “string”
}
]
},
“options”: {}
},
“id”: “836ec432-17db-40b7-b14e-497360a2456b”,
“name”: “get link of the rest of the products”,
“type”: “n8n-nodes-base.set”,
“typeVersion”: 3.4,
“position”: [
-2340,
2280
]
},
{
“parameters”: {
“path”: “534fac48-0071-405e-b734-042bf6f10492”,
“formTitle”: “Start”,
“formFields”: {
“values”: [
{
“fieldLabel”: “Start”
}
]
},
“options”: {}
},
“id”: “91615d59-56a2-4e4b-b64d-9f19445f6615”,
“name”: “n8n Form Trigger”,
“type”: “n8n-nodes-base.formTrigger”,
“typeVersion”: 2.1,
“position”: [
-2540,
1140
],
“webhookId”: “534fac48-0071-405e-b734-042bf6f10492”
},
{
“parameters”: {
“batchSize”: 50,
“options”: {}
},
“id”: “3c521ae9-6046-43e7-b261-37179c908e43”,
“name”: “Loop Over Items”,
“type”: “n8n-nodes-base.splitInBatches”,
“typeVersion”: 3,
“position”: [
-2140,
2280
]
},
{
“parameters”: {
“sendTo”: “[email protected]”,
“subject”: “all products are added”,
“message”: “Hi, All the products have been copied to the new Shopify store.”,
“options”: {}
},
“id”: “4a92b214-7d0c-4805-ae7d-7a5c2394a2c3”,
“name”: “Gmail”,
“type”: “n8n-nodes-base.gmail”,
“typeVersion”: 2.1,
“position”: [
-1600,
1600
],
“credentials”: {
“gmailOAuth2”: {
“id”: “IiigyefCD0HnmXf8”,
“name”: “Gmail account”
}
}
},
{
“parameters”: {
“url”: “={{ $(‘remove html on get link product 2’).item.json.link }}”,
“authentication”: “predefinedCredentialType”,
“nodeCredentialType”: “shopifyAccessTokenApi”,
“sendQuery”: true,
“queryParameters”: {
“parameters”: [
{
“name”: “limit”,
“value”: “1”
}
]
},
“options”: {
“response”: {
“response”: {
“fullResponse”: true
}
}
}
},
“id”: “5c73b8fa-ad82-4045-8305-1e4da0e671ef”,
“name”: “get succeeding product”,
“type”: “n8n-nodes-base.httpRequest”,
“typeVersion”: 4.2,
“position”: [
-2140,
1800
],
“credentials”: {
“shopifyAccessTokenApi”: {
“id”: “DmU2uqhqLN0rk3Nm”,
“name”: “Dubai Test Store”
}
}
}
],
“connections”: {
“count how many products”: {
“main”: [
[
{
“node”: “get product 1”,
“type”: “main”,
“index”: 0
}
]
]
},
“get product 1”: {
“main”: [
[
{
“node”: “add product 1 to destination store”,
“type”: “main”,
“index”: 0
}
]
]
},
“get link product 2”: {
“main”: [
[
{
“node”: “does product link have next?”,
“type”: “main”,
“index”: 0
}
]
]
},
“remove html on get link product 2”: {
“main”: [
[
{
“node”: “get succeeding product”,
“type”: “main”,
“index”: 0
}
]
]
},
“add product 1 to destination store”: {
“main”: [
[
{
“node”: “add product 1 price, compare at price and sku”,
“type”: “main”,
“index”: 0
}
]
]
},
“add product 1 price, compare at price and sku”: {
“main”: [
[
{
“node”: “get link product 2”,
“type”: “main”,
“index”: 0
}
]
]
},
“add product 2 to destination store”: {
“main”: [
[
{
“node”: “add product 2 price, compare at price and sku”,
“type”: “main”,
“index”: 0
}
]
]
},
“add product 2 price, compare at price and sku”: {
“main”: [
[
{
“node”: “get link of the rest of the products”,
“type”: “main”,
“index”: 0
}
]
]
},
“does product link have next?”: {
“main”: [
[
{
“node”: “remove html on get link product 2”,
“type”: “main”,
“index”: 0
}
],
[
{
“node”: “Gmail”,
“type”: “main”,
“index”: 0
}
]
]
},
“get link of the rest of the products”: {
“main”: [
[
{
“node”: “Loop Over Items”,
“type”: “main”,
“index”: 0
}
]
]
},
“n8n Form Trigger”: {
“main”: [
[
{
“node”: “count how many products”,
“type”: “main”,
“index”: 0
}
]
]
},
“Loop Over Items”: {
“main”: [
null,
[
{
“node”: “does product link have next?”,
“type”: “main”,
“index”: 0
}
]
]
},
“get succeeding product”: {
“main”: [
[
{
“node”: “add product 2 to destination store”,
“type”: “main”,
“index”: 0
}
]
]
}
},
“pinData”: {}
}

could you please advise what might be wrong in the loop? just need to figure out why it stops at 3 products and why the loop has a done branch even if the workflow has not finished copying all products to the destination store.

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.