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.