Question

How to manipulate the data from Shopify Order Created trigger

  • 12 May 2021
  • 4 replies
  • 120 views

Using shopify > Order Created as a trigger, the return object looks something like this:

{
  ...
  Line_Items_Name: product1, product2, product3
  Line_Items_Price: 4.99, 5.99. 2.99
  Line_Items_Tax_Rate: [0.025, 0.01, 0.04], null, [0.012, 0.015, 0.01]
}

When trying to work with the Line_Items_Tax_Rate lines, zapier is flattening this array and removing the null values.  The above example looks like [0.025, 0.01, 0.04, 0.012, 0.015, 0.01].  When mapping Line_Items_Tax_Rate to a search, for example, Zapier thinks there are 6 tax lines, not 3.

How can I get Zapier to not flatten out the array, and when i reference bundle.InputData.tax_rate, it returns the array of rates per line (and null for line 2) for the 3 lines and NOT the value of the flattened array[i].


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

4 replies

Userlevel 7
Badge +14

Hi @jbourgoin 

Try using a Formatter > Utilities > Line Itemizer step in the Zap: https://zapier.com/help/doc/how-use-formatter-functions

 

Check out this article:

 

My issue with this is that I need it to happen from the search step itself by coding it using cli instead of requiring our users to add scripts & formatter functions to get their shopify order to create a successful invoice.

Userlevel 7
Badge +12

One thing you could try is to pass all the data from the trigger step through to a webhook (use data pass through) into another zap (triggered by a catch raw hook). Then you should get back more of the raw response which can be used.

Edit.. Just saw that you were building an integration, so the above won’t be helpful for your specific use case. 

Userlevel 7
Badge +10

@jbourgoin 
Just checking in to see if you still need help with this?