Question

How can I setup a Zap to create one Shopify order with multiple line items from different products?

  • 4 October 2023
  • 5 replies
  • 374 views

Hi There,

I’m setting up a zap that will look up Shopify variations for multiple existing products in my Shopify, and will then create one invoice. Example:

Suppose I have 4 line items extracted from 4 rows in google sheets, each row has one unique identifier that indicates that all 4 line items belong to the same order:

  • 2 items from Shopify product id 123456, and
  • 1 item from Shopify product id 789101, and
  • 1 item from Shopify  product id 111213.

I want to create one order in Shopify that contains these line items.

My setup:

I extracted the data from a customer’s Shopify order into a Google Sheets form (Zap 1 - Shopify Customer A/C to Google Sheets). I then created Zap 2 that will trigger when new rows are added to this Google Sheet.

I tested several configurations but the result is normally one of these:

  1. Order is created in Shopify with 1 line item from 1 product and its correct variation & price
  2. Order is created in Shopify with 4 line item from 1 product and all 4 line items have the same price, which is incorrect

I then added a filter because this article recommended to set an end for the loop. I then published the loop and added the data to the Google Sheet to trigger the Zap. However, now nothing is happening at all, that is, the Zap doesn’t create an order at all.

Any help or guidance is much appreciated 😃

Thank you!

Anja

 

Screenshots:

Zap
Loop test is working
Loop data to find Shopify variant

​​​​

 


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

5 replies

Userlevel 7
Badge +11

Hi and welcome to the Community, @Anja243! 👋

That’s very strange. In the Zap History for the last variant in the loop did it pass the filter or was it halted? 

Can you share some screenshots showing the filter results on step 5 and the Data In and Data Out for step 6 on a recent run of the Zap (on the last iteration) which should have created the order in Shopify but didn’t? 

I’d like to check whether there’s any clue there as to why the order wasn’t created when it should have been. Please be sure to remove/hide any private information from the screenshots before sharing (like names, emails, addresses etc.).

Looking forward to hearing from you on this!

Hi Sam,

Thank you so much for responding to my post - I really appreciate it! :)

I have made some progress and the Data In and Data Out has been very helpful to review and I now have 2 examples:

Example 1 - The original 6step Zap as per screenshot in my original post

Zap History: 16 tasks used for this Zap run.

Result in Shopify: 4 individual shopify orders created, each order lists the 4th (=last) loop item only; the other 3 line items are not there at all. That is all 4 order invoices create the line item title, price and sku for this 4th loop item correctly. 

I have attached one set of screenshots which shows data from one of the 16 task runs.

Example 2 - I removed the filter step (step 5), and proceeded without it

Zap History: 16 tasks used for this Zap run.

Result in Shopify: 16 individual shopify orders created, incl. 4 individual shopify orders for each of the 4 line items. The individual order invoices for each of the 4 line items has the correct line item title, price and sku for this item. 

See attached screenshot of the 16 individual orders created in Shopify. The Data In and Data Out screenshots for Step 4. Find Product Variant by Title in Shopify, and - in this case - Step 5. Create Order in Shopify, seem the same to me as in Example 1 in terms of the data.

 

It seems I’m so close to getting the desired result which is: Create one Shopify order which, in this example, lists all 4 line items that the loop has correctly identified from Google Sheets. What am I missing? :)

Userlevel 7
Badge +11

Thanks for getting back to me here, @Anja243

Really sorry but it seems that the images didn’t fully upload before your message was posted. This is how they’re appearing on my end: cb689595667525a6079c95161d9d5a0f.png

Can you try sharing them again so we can take a look at them? Keen to help get to the bottom of this!

Here they are again - thank you

 

 

Example 2 - Shopify Result (16x individual orders created)

 

Userlevel 7
Badge +11

Thanks for sending those screenshots over @Anja243. 🙂

Ah, ok I think what was happening is that for the example 1 the filter was preventing the loop from adding each of the line item details to the order and so it only added the last line item as that’s the only information that made it past the filter step. And with example 2, all of the line items were handled separated for each run of the loop and so they were each added into a separate Shopify order. 

You might be able to get around by using a Storage by Zapier action to store the different product variant information for each line item, then have the filter check if it’s the last loop iteration so it only creates a single order and uses all the information that was stored in the order. When setting up the Storage by Zapier action though, in order to make sure the product information stored is associated with the correct order you’ll want to use a unique value for as the storage key - an order ID or reference number for example would be good to use. When digging into this I found there was a similar question asked that suggested the same workaround of using Storage by Zapier which you can see more details on here: 


And I’d recommend checking out the help guides on Storage by Zapier to learn more about how to set it up and use it:


Hope that helps to get you pointed in the right direction. Please do let us know how you get on with this, happy to assist further if you get stuck at all. 🙂