Skip to main content

Hi I have pulled Shopify customer tags as a list into Zapier separated by commas. I would like to remove items from the list that starts with “fbn”. The order of the items in the list will vary per customer along with the number of items in the list.

So for example I have Shopify tags like this:

blue, large, fbn01, hat

With Zapier how can I remove fbn01 by searching the string for fbn.

Thanks

Hi there @Diggity,

Welcome to the Community! 🎉

You can add a Text in Formatter by Zapier - Replace function to remove the “fbn” data in your tags. The setup will look like this:

56bf2b2785520e33b440add139847f29.png
(view larger)

Here’s the output:

a6d5be74998214974e052a03aa171280.png
(view larger)

Hopefully, this helps! 😊


Hi @Diggity 

Good question.

You can use a Code step for this: https://zapier.com/apps/code/help

Some guidance:

 


Thanks Ken.a and Troy! I was trying to exclude items that contain the string so Ken.a’s method didn’t work for that. But ended up finding Troys article here which worked great.
 

 

So final code is:

let Set = inputData.Set.split(","); // creates array by splitting Input Data Variable at commas

let FilterBy = inputData.FilterBy; // value to filter the array by

Set = Set.filter(i => !i.includes(FilterBy)); // use ! EXCLUDE values in array

output = u{Set}];

 


That’s great news @Diggity! I’m glad to hear Troy’s suggestion worked!

Also, thank you for sharing the code this will be helpful to our other Community members who might run into a similar issue.

If you have any other questions, please don’t hesitate to reach out. We’re always happy to help! 😊