Skip to main content

Hi

I’ve got my weekly summary task email from zapier and noticed that one specific Zap (runs once per month) used up to 295 tasks.
Which is a lot.

So I’m here wondering if any of you have a similar use case and how you guys limit the actions.

Use case:
* Woocommerce webshop
* I need all orders that ordered a specifik Product variation. 

I’m using the woocommerce API with the built in filter on product ID:

/wp-json/wc/v3/orders?status=completed,processing&after=2021-07-30T18:46:32&per_page=50&product=2111&order=desc

There’s no built in filter with the API to pass through a variation ID. So I’m forced to use a loop with a condition:

 

=> Which is the reason of the many actions. If the API call returns 50 lines; each line can contain more than one product/variation which need to be filtered.

Any suggestions to get the number of actions down? (I can limit the amount with the date, but currently I’m only fetching the first 50 returned lines anyway)

 

Thanks in advance for having a look at it.

Hi @Hexmans!

My understanding of the issue is that you need the Zap to run only for a specific product variation ID, but the as the production variations are in a line item field, you need to run a loop and filter step for each product variation in the order, is that right?

If so, I think I have a solution:

Add a Formatter by Zapier step into the Zap and choose Utilities > Line-item to text. This will take the Product variation field and convert it from line items to one long string of text with a comma after each variation. 

 

In the filter step, set it up so that the filter is looking for the Product variation ID you want to filter for followed by a comma. The comma will stop the filter from stopping the Zap if you have a number like 345 and you’re trying to filter for 123456. 

 

Set up that way, you would have one task to convert the line items and 1 task to search the string. Would that work with the data that you have?


Hi @Hexmans!

My understanding of the issue is that you need the Zap to run only for a specific product variation ID, but the as the production variations are in a line item field, you need to run a loop and filter step for each product variation in the order, is that right?

If so, I think I have a solution:

Add a Formatter by Zapier step into the Zap and choose Utilities > Line-item to text. This will take the Product variation field and convert it from line items to one long string of text with a comma after each variation. 

 

In the filter step, set it up so that the filter is looking for the Product variation ID you want to filter for followed by a comma. The comma will stop the filter from stopping the Zap if you have a number like 345 and you’re trying to filter for 123456. 

 

Set up that way, you would have one task to convert the line items and 1 task to search the string. Would that work with the data that you have?

 

Thanks for your response.
So I’m testing that out right now. But I’m a bit confused
The API call returns

Order A with one or more product/variation

Order B with one or more product/variation

Order C with one or more product/variation

I still have to loop order A, B and C to then convert each line variation ID into text and filter, right?

I need all the orders that have bought a specific variation ID


Hi @Hexmans!

You wouldn’t need to loop the line items before convert them into text. Converting the line items to text will turn them into one regular text field, if you set up the filter step to look at that text field (as opposed to the original live items) the filter can look at that one field to find any mention of ‘variation D’. 

I hope that clears things up, let us know if you have any other questions!


Hi @Hexmans, were you able to give the Formatter line-item to text action a go? Let us know if it worked or if you still need some help!