Add multiple duplicated rows in case of multiple unique items in an order

Right now I have added 2 modules (Woocommerce trigger - watch orders and Google sheets - add a row) And data is transferring greatly but orders that have multiple unique products get only one row added = other products are not being added in the sheets due to this.
I would like to get some help with this following task.
If a new order has more than 1 unique product ID then duplicate multiple new rows per each unique product ID , without adding a new Order ID for each one of those rows, only the first one.

Hi @Veins_Seleckis,

What you can do is,

  1. Put a Iterator between the Woocommerce Watch Orders and Google Sheets.
  2. in Iterator, Pass the LineItems(I believe it is this or OrderLineItems in WooCommerce not sure which one), but you need to iterate over the orders coming from the woocommerce to get those products
  3. In GoogleSheet Module, Use the Product Details obtained from the Iterator and for the rest you can just use the mapping from Watch Orders

Now, For the Order Number what you can do is, Use If Formula in GoogleSheet Column for Order Number whereby you need to do,

if(Bundle Order Position = 1; OrderNumber)

Whereby, Bundler Order Position is the output of iterator so you need to map that.

1 Like

Thank you for your answer will try this out. But I didn’t quite get this part. Sorry, Im very new to this site, its my second day here. :smile:
Now, For the Order Number what you can do is, Use If Formula in GoogleSheet Column for Order Number whereby you need to do,

if(Bundle Order Position = 1; OrderNumber)

Whereby, Bundler Order Position is the output of iterator so you need to map that.

It is for what you have described in the initial post, i.e if there are multiple products then you want the Order Number in the first row inserted from that order and leave it as blank for the rest.

{{if(1.__IMTINDEX__ = 1; “OrderNumberFromWoocommerce”)}}

Screenshot from 2023-04-24 17-14-46

You should use this formula , in GoogleSheet OrderNumber column. OrderNumerFromWooCommerce is the mapped value from WooCommerce.

1 Like

So I should add this Tool module to my scenario right?

where can i get that green ‘‘bundle order position’’ variable from?

No you don’t need to use the Tool Module, You can do it directly on GSheet Module, For the bundle order position it is available once you add the Iterator Module.

1 Like

So I added {{1.lineItems.productId}} to my iterator . is that correct? and then added the formula in Order ID field (in gsheets) that you showed me in step3.

Just use 1.lineItems in the iterator, it will loop/iterate over all the products for this specific order.

2 Likes