A newbe question. Have googled and read make.com documentation, cannot get it to work.
Trying to get data automatically from woocommerce to google speadsheet/coda.
Woocommerce downloads order array. All works, i can get it to google sheets. All good if there is ONE item in cart ( {{1.lineItems[].productId}})
.
If i there are multiple items, I cannot figure it out. Could someone point in a right direction.
If i use:
{{1.lineItems[1].quantity}} # {{1.lineItems[1].name}}
{{1.lineItems[2].quantity}} # {{1.lineItems[2].name}}
{{1.lineItems[3].quantity}} # {{1.lineItems[3].name}}
It works as above, I can get the first, second and third element of the array. But this is probably not the most efficient way.
How is the correct procedure to tell the script in make.com to
- count how many lines is in the array
- based on that LOOP through the array the correct amount of times.
If i input function as:
a) {{get(1.lineItems; 1)}} -> i get [Collection] (so array is there)
b) {{map(1.lineItems; 1.lineItems[].id)}} -> i get nothing visible
c) {{get(map(1.lineItems; 1.lineItems[].id); 1)}} ->i get nothing visible
d) {{length(1.lineItems)}} - i get correct number of items in the array
I understand this is probably a basic question, but would appriciate a hint, how to solve this. How to get the script to loop through the array and output each order name or id separately.