Skip to main content

hi,

in my shopify store, i want to use the quantity input to create new documentS in my firebase database.

 

the case: a user has made a paid order for one product, he bought 10 items from the same product, now i want to create 10 new documents in a specific collection in my firebase database. each document should have a unique id. basically i want to multiply documents by the order items quantity. 

 

the other acceptable alternative is to do so but with google spreadsheets.

 

thanks in advance

Hi @kmyter 

Try using the Looping app: https://zapier.com/apps/looping/help

 

 


hi @Troy Tessalone , 

thanks for this.

it works fine for the google sheets. Thank you!

 

however, when i integrate the firebase part in order to create documents in my firebase, it only takes the first item, it doesn’t loop through all created rows. 

this is my zap :

 

 

in the Firebase action, i use the column n from my google sheets, which typically contains the output from the action 2.loop. I expect the action 4 to create a separate document for each row. which is not the case:

 

 


@kmyter 

Try mapping the variable output from the Looping step. (from step 2 to step 4)


yes, i did so.

step 3 gives me the following results (5 results). I am interested in the Rows COL B output to be used as a document id for the firebase database.

 

in step 4, i used the output from step 3 (Rows COL 😎 as a document id,

 

the result in my firebase is still only one document, despite i have 5 output rows from step 3 (basically i expect 5 documents to be created in my firebase database).

 

am i missing something ?


Hey there @kmyter 👋

As that Create Multiple Spreadsheet Rows Google Sheets action creates multiple rows, you’ll want to move that ahead of the loop otherwise you would end up with duplicate rows being added each time the Zap runs and loops through multiple items. And I’d also suggest changing the current Looping by Zapier action to be a Create Loop from Line Items action instead of a Create Looping from Numbers action:
19906c6e9583e5925227291bc20a4385.png

For the loop action you’d set it up to retrieve any data from the Google Sheets or Shopify step that the Firebase/Firestore action will need. For example if you just need the ID and the name of any items ordered and that information is already added into the Google Sheets spreadsheet then you could set up like this:
e4ac176867af025d8fa4986443ab2555.png

Then in the Create Cloud Firestore Document action you’d select the relevant value name field that’s output by the loop, for example:
5c3848222498d7817c97dd141a154162.png

IMPORTANT: Make sure you don’t select any fields with the word “Preview” in the name as those are shown for preview purposes only and will not appear in when the Zap actually runs.

It’s expected that when you test that action in the Zap editor it would only be able to act upon the data received from the first loop but when it’s switched on it would run the Create Cloud Firestore Document action once in each loop. So if there’s 5 line items passed to the Looping by Zapier action, it would loop 5 times and 5 documents would be created. You can find out more about using loops here: Loop your Zap actions

Can you give the above suggestions a try and let me know whether that sorts it?