Merging two arrays for Xero Line Items submission

Hi,
I need to merge line items and fees from a woocommerce order into line items on an invoice in xero.
I have created the flow and outputs from both aggregators (one for woocommerce line items and the other one for woocommerce fees) can be sucesfully used as line items in the xero invoice creation steps.

I then added a merge step to bring the two arrays together and create single array for line items in the xero submission:

However, that fails with the follwoing error:

Any suggestions?

Kind regards,

Jovica

Hello @Jovica_M,

Welcome to the Make Community!

Here’s how I normally approach something like this…

For example:

  1. You’ve got one collection containing three pieces of info: product number, quantity, price
  2. You’ve got a second collection containing just the product number and fee.

I don’t remember what Xero requires for line items, but let’s just say it’s those 4 fields.
Use an iterator on the first collection followed by an array aggregator, followed by Xero module which accepts the line items array. Once the Xero module is connected to the array aggregator, that will give the array aggregator access to the data structure that Xero needs for line items, so you should be able to select that data structure from the list of options.

In each iteration, you’ll already have access to the product number, quantity, and price.
Pop those variables directly into the fields in the aggregator.

For the fee, you can use map() and get() in the aggregator’s fee field to get the fee from the second collection.

Hope that makes sense and hope it helps!