Google sheets/woocommerce: How do I correctly map Variation1 and Variation2 from line item meta?

:bullseye: What is your goal?

To have a seperate row for each item on a single order.

:thinking: What is the problem & what have you tried?

I integrated WooCommerce with Google Sheets to automatically log my orders instead of entering them manually.

It works fine for single-product orders. But when a customer buys multiple products in one order, only the first product shows up in the sheet.

In the screenshot, row 138 shows only one item under “Item description,” even though two products were purchased.

In row 139, I tried adding multiple “Line items” fields to capture additional products, but it just keeps repeating the first product (“Daphnie Belle Dress”) instead of pulling the others.

Ideally, each product in an order would be added as a separate row. If that’s not possible, I at least want all products from the order to appear within a single cell.

How can I fix this?

:camera_with_flash: Screenshots (scenario flow, module settings, errors)

Hey there,

can you also show screenshots of what’s coming from woocommerce and how the google sheets module is setup?

Hello,

I am curious what is showing up when Make runs? I personally would expect it to show up as multiple bundles as an output. This would mean you could leave the scenario to just simply map “Create a New Row” in Sheets and just map the single item. Most likely WooCommerce is outputting the purchase as LineItems which means that you would need an Iterator to separate them. Do you know what Make is outputting in the response?

To “split” an array of items (products in your case) into multiple bundles, use an Iterator module.

“Looping” Through Array Items

When you see an array in a module’s output, think of using an Iterator module. This allows you to individually access and process each item in the array.

In this example, this variable is an array of items (collections). You’ll want to map this variable in an Iterator module.

Question: Have you tried mapping your array variable into an Iterator module, ran the scenario once, and view the output? Then …

Combining Bundles Using Aggregators

Every result/item from some module types (like Trigger / Iterator / List / Search / Match modules) can potentially and likely output more than one bundle. These multiple bundles will individually run subsequent modules once per bundle, which is not optimal in most cases:

  • one operation per bundle per module, which could lead to…
  • use of multiple credits per bundle per module (some modules use more than one credit)
View example screenshots

Aggregator Example

The “Search Rows” module runs one time, returning 999 results (999 bundles).

  • Without Aggregator: the tools module run 999 times (999 operations)


    (and if there are more modules, they run 999 times each)

  • With Aggregator: the tools module only runs 1 time (1 operation)

:warning: Warning: :police_car_light:
This can easily use your entire quota of credits if you are not careful or fail to understand this concept.

To “combine” multiple bundles into a single variable, so that you can process all of the items in a single operation, you’ll need to use an aggregator. Aggregators is a type of module that accumulates bundles and outputs one bundle (unless you are using “Group By”). An example of a commonly-used aggregator module is the Array aggregator module.

You can find out more about some other aggregator modules here:

Question: Which is the best aggregator do you think you’ll need for your use-case?

Setting the Correct Aggregator Source

You need to set the “Source Module” field of the aggregator to where the bundles are coming from. This is usually an iterator module, but can also be a search/list/repeater module, or even the trigger module!

Mapping a Complex (Collection) Structure Into an Array Field

The Array Aggregator module is very powerful because it allows you to build a new complex array of collections that matches a later module’s array field to map multiple items (collections) to it. Such fields initially may allow you to manually add individual items, but toggle the “Map” switch on, and you can map an array variable (from an Array Aggregator) containing multiple collections.

Simply select the respective “Target structure type” in an Array Aggregator module.

As you can see from the example above, the “Map” toggle on complex array fields are used when you have an array variable (like from an array aggregator).

:clipboard: Note: :light_bulb:
Other combinations of modules may also allow you to generate an array that matches a future module field’s array structure, like “Aggregate to JSON + Parse JSON”, or “Create JSON + Parse JSON”, but this is an advanced topic.

Question: Are you mapping your array into a field that accepts more than one item/collection?

Example

Here is an example of how your scenario could look like:

This is just an example. Your solution may or may not look like this depending on requirements and actual data.

For more information, see “Mapping with arrays” in the Help Centre. I also suggest going through the Make Academy, which also covers the use of Iterators & Aggregators.

— @samliew

1 Like

:bullseye: What is your goal?

I’m trying to automate my WooCommerce orders into Google Sheets using Make (Integromat), and I’m stuck on extracting product variations (Size + Color).

:thinking: What is the problem?

I’m trying to automate my WooCommerce orders into Google Sheets, and I’m stuck on extracting product variations (Size + Color).

Problem:
Meta data only shows ONE variation at a time (either Size or Color depending on which variation comes first on that product page). It shows the same variation1 on the next column where its supposed to show Variation2 (as seen in the screenshot)

Tried adding second iterator + router + filters, but it’s getting messy and still not giving both values in the same row or i could be doing it wrong.

:test_tube: What have you tried so far?

My current workflow is:
WooCommerce “Watch Orders”
Iterator on Line Items → 1 product = 1 row (exactly what i needed)
Then I tried getting Size and Color from “meta data”, did not work.

:camera_with_flash: Screenshots: scenario setup, module configuration, errors

Hello, OP here.

I was able to fix this by adding a simple iterator and selecting “line items” in between Woo commerce and Google sheets. Now it adds a new row for every product.

2 Likes

Hey there,

can you show what the input bundle looks like? If you are working with an array of values, then you can use the map() function to find the correct ones and map them in the respective fields.

Hi,

Forgive me, non IT person here, can you let me know what input bundle is? Do the screenshots below give you any information on the same?

Yeah you mapped only the first variation there. Change the mapping to whatever is coming from the iterator, not from the woocommerce module.

Here you go,

Tried with the iterator, still doesnt work. The problem is, the meta menu only shows one variation to begin with. I have highlighted this with a red box.

That is also an array, and you are again mapping one item from it. Add this inside a second iterator to get the separate items from it.

Thanks! can you walk me through the steps? What do I add in the second iterator?

Hey! Wanted to check in and see if you could help me out this. can you walk me through the steps? What do I add in the second iterator? Thanks a ton!

Put a second iterator and map the metadata array inside.

Hello,

I did this and Instead of putting Variation1 in “H” column and Variation2 in “I” column, it has now put variation1 in both columns on the same row and made another row to show variation2.

The red box is one item and the yellow box is another item.

So the result is:

  • First row: both columns show Variation1

  • Second row: both columns show Variation2

What I actually need is Variation1 in one column and Variation2 next to the first one, in the same row.

This is the workflow I created. I hope its correct.

Hey, hope you can see my previous response

:bullseye: What is your goal?

Hey everyone,

I’m trying to automate my WooCommerce orders into Google Sheets using Make, and I’m stuck on handling product variations.

:thinking: What is the problem?

What I want:

  • Variation1 and Variation2 should go into separate columns in the same row for each product

What’s happening instead:

  • It duplicates Variation1 in both fields on the same row
  • Then creates a second row where it duplicates Variation2 in both fields
  • So instead of one row with both variations, I end up with two rows — each repeating a single variation

How do I make both variations land in the same row instead of getting split like this?

:test_tube: What have you tried so far?

Here’s what I’ve set up:

  • WooCommerce → Watch Orders
  • Iterator → Line Items (to get each product as a separate row)
  • Second Iterator → Meta Data (to extract variations)
  • Google Sheets → Add a Row

:camera_with_flash: Screenshots: scenario setup, module configuration, errors

Your second iterator on Meta Data is the problem. Every time it iterates, it triggers a new Google Sheets row, that’s why you’re getting duplicate rows.

Remove the second iterator. Instead, use get() and map() directly in your Google Sheets module to pull each variation by its key name.

For your Size column: {{get(map(1.lineItems[].meta_data; "value"; "key"; "YOUR_SIZE_KEY"); 1)}}

For your Color column: {{get(map(1.lineItems[].meta_data; "value"; "key"; "YOUR_COLOR_KEY"); 1)}}

To find your actual key names: run the scenario once, click the output bundle on your Line Items iterator, and expand the meta_data array. You’ll see the exact key names there (something like “Size”, “pa_size”, “Color”, etc). Use those in the formula above.

The map() function searches the meta_data array for the matching key and returns its value. get() grabs the first result. One row per product, both variations in separate columns.

OK OK I see, so each item in the meta data is different custom property and you want them in different places. So you don’t need the second iterator, you need to manipulate the data instead.

Are the items in the array with fixed positions? You can then use the order index to map the respective item in the respective column.
If they are not with fixed positions, you then need to use the map() function to find the specific items and map them in their specific columns.

Hey! thank you for giving me the step by step. When I run the scenario, only one variation shows up on the meta data. The second variation doesnt show up. I tried to put your formula by adding pa_size since it showed me the size, but it came out blank on google sheets