WooCommerce has an order.created
webhook.
If the order is made inside WooCommerce Store. It’ll trigger.
Then After 2 Mins of Wait.
WooCommerce Node will get the Order Status.
And with the help of IF Node.
-
If the status is
processing
It’ll send to TRUE Branch. -
If the status is
pending
it’ll send to FALSE Branch (loop).
Then Again wait for 2 mins then the same thing comes in a loop.
But the problem is: If I don’t have a 3 times loop or Loop Limit. It’ll become a non-ending loop.
How to solve this issue? or Any Ideas on this?
Workflow:
{
"nodes": [
{
"parameters": {},
"name": "Start",
"type": "n8n-nodes-base.start",
"typeVersion": 1,
"position": [
250,
300
]
},
{
"parameters": {
"event": "order.created"
},
"name": "WooCommerce Trigger",
"type": "n8n-nodes-base.wooCommerceTrigger",
"typeVersion": 1,
"position": [
660,
590
],
"webhookId": "a6781718-8f00-4c4c-abbb-42e5aa54f7f1",
"credentials": {
"wooCommerceApi": "Store WooCommerece"
}
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "processing",
"value2": "processing"
}
]
}
},
"name": "Check Payment Status",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
1170,
320
]
},
{
"parameters": {
"functionCode": "const waitTimeSeconds = 120;\n\nreturn new Promise((resolve) => {\n setTimeout(() => {\n resolve(items);\n }, waitTimeSeconds * 1000);\n});\n\n"
},
"name": "Wait 2 Mins",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
920,
590
]
},
{
"parameters": {
"resource": "order",
"operation": "get",
"orderId": "ID Here"
},
"name": "WooCommerce Get Payment Status",
"type": "n8n-nodes-base.wooCommerce",
"typeVersion": 1,
"position": [
930,
320
],
"credentials": {
"wooCommerceApi": "Store WooCommerece"
}
},
{
"parameters": {},
"name": "NoOp",
"type": "n8n-nodes-base.noOp",
"typeVersion": 1,
"position": [
1370,
300
]
}
],
"connections": {
"WooCommerce Trigger": {
"main": [
[
{
"node": "Wait 2 Mins",
"type": "main",
"index": 0
}
]
]
},
"Check Payment Status": {
"main": [
[
{
"node": "NoOp",
"type": "main",
"index": 0
}
],
[
{
"node": "Wait 2 Mins",
"type": "main",
"index": 0
}
]
]
},
"Wait 2 Mins": {
"main": [
[
{
"node": "WooCommerce Get Payment Status",
"type": "main",
"index": 0
}
]
]
},
"WooCommerce Get Payment Status": {
"main": [
[
{
"node": "Check Payment Status",
"type": "main",
"index": 0
}
]
]
}
}
}