Question

How to skip an iteration from a Loop?

  • 21 March 2024
  • 3 replies
  • 70 views

Hiya!

I’m currently working on a little integration project between our own ticketing software and Shopify. What it essentially does is take a New Paid Order from Shopify and then write all the necessary data as an order on our system.

A big part of this workflow I’ve created is using the Loop task to reformat each item in the Shopify order into a form that’s digestible by our ticketing software. 

We’ve recently received a request from a client interested in this workflow about the possibility of removing a certain item (is their case -- paper bags) from the Loop.

I was going to write some custom code that skips over any loop iteration with the item name “Paper Bag”; using the Code task to do this. But I was wondering if there was another way to pull this off that I’m not aware of?  

Many thanks in advance for your help!

~ Shaikhul


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

3 replies

Userlevel 7
Badge +14

Hi @Shaikhul 

If you are using the Looping app, then add a Filter as the first step within the Loop: https://zapier.com/apps/files-by-zapier/integrations

 

If you still need help, post screenshots with how your Zap steps are outlined and configured to give us more context.

Hi @Troy Tessalone ,

Thanks for the reply.

I’ve tried to apply a filter as advised but upon testing, it seems to shut down the whole run rather than continuing onto the next iteration. See below for the Loop steps and setup of the filter.

 

The second filter is there to break out of the loop once the last loop iteration is complete and hasn’t caused any problems.

Thanks again for your help!

~ Shaikhul

Userlevel 7
Badge +14

@Shaikhul 

Looping Help: https://zapier.com/apps/looping/help

You can only test the first Loop iteration.

On live Zap Runs, loop iterations run in parallel (unless configured to run sequentially).

The issue with the second filter is if the Last Loop iteration gets filtered, then those last Zap steps would not run.

You may need to use Paths to ensure the Last Loop iteration is processed by it’s own Path.

You may need to add a Delay (For) within that Path.