Describe the problem/error/question
- Workflow receives a webhook from Shopify that a new order is placed.
- Workflow also has a manual execution node for testing.
- The first node after the Shopify new order webhook is hit (or the workflow is manually executed via the manual node), is a Set node.
- In this Set node, I have a variable called OrderID
Here’s the money maker:
I am trying to do a simple expression in the value setter for OrderID that checks to see if the order-id node exists in the JSON payload from the Shopify webhook. If it does, then I want to set the OrderID variable value to Shopify webhook JSON → order id node value.
If the Shopify webhook JSON → order ID node doesn’t exist, then I want to set the OrderID value to a static order ID so that I can automatically test the workflow without having to change variable values.
Here is what I have for the expression in the OrderID value (one line):
{{ $(‘Shopify Paid Order Webhook Received’).item.json[“body”][“id”] ? $(‘Shopify Paid Order Webhook Received’).item.json[“body”][“id”] : “5118138253462”; }}
What am I doing wrong?
What is the error message (if any)?
Please share your workflow
(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)
Share the output returned by the last node
Information on your n8n setup
- n8n version:
- Database (default: SQLite):
- n8n EXECUTIONS_PROCESS setting (default: own, main):
- Running n8n via (Docker, npm, n8n cloud, desktop app):
- Operating system: