Hope everyone is well, this might be super obviously but I am trying to get data from a API call earlier in a workflow and use it for a subsequent call (to shopify).
There is a loop that calls the product of each item but I am getting undefined. I assuming it is because I can’t access the data before the loop after the loop is aggregated.
Set Node (just before your loop):
Use a “Set” node to merge or copy the key fields from your initial API response into each item. For example, if your upstream call returns { storeId, location, … } and you’re about to split out items via SplitInBatches or SplitInItems, add those fields on every item first:
Loop (SplitInBatches or SplitInItems):
Now each batch/item carries along storeId (and any other metadata), so when you call Shopify you can use {{$json["storeId"]}} without hitting “undefined.”
2) Merge Back After the Loop
Store Original Data:
Keep your initial API node in scope by not overwriting it.
Split and Process:
Use SplitInBatches (or a custom loop) to call Shopify for each product.
Merge Node (mode: “Pass Through” + “Keep Key Matches”):
After you finish the per-item calls, link your loop output and the original API node into a Merge node.
Left input = loop results
Right input = original API response
Mode = “Pass Through” (so loop items stay first)
Match By = a common key (for instance, productId)
This re-attaches the original fields back onto each processed item.
Using first() is a good quick fix for now especially if the data is static. Enriching items before the loop or merging afterward will give you more flexibility for scaling and handling dynamic data. Happy to help
@masoom - Yeah definitely agree. The data in the process is quiet static (as its effectively an shopify graphQL call for a specific order.
What you have written above, is def something to consider on more complex flows where it is less static. I come from nodejs land, so normally i would hardcode this logic so getting to ropes a little bit.