Item not going to Code node and array not working properly on n8n

Dear everyone,

My WooCommerce passes an array of 3 products and n8n considers that array as 1 item. I want to carry that array to my 3 code nodes but only my first code node can extract product 1 from that array properly. My other code nodes are configured properly but they are not responding to the array. How can I fix it please?
**n8n version: 1.59.3

Alternatively, I tried using Javascript in code node to carry 3 products at once in 1 code node instead 3 code nodes. However, the output doesn’t return {} which results in error as my ERP system requires array to be inside {}.

Below is bottom part of my javascript code:
const erpItems = order.line_items.map(line => {
return {
item_code: line.cd,
qty: line.qty,
};
});

// Return a single object for n8n
return {
json: {
customer: order.name,
order_type: ‘Sales’,
// The child table:
fooditems: erpItems
}
};

Thanks in advanced.

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.