Best answer

How do I filter out non-line items from Shopify and translate that to Airtable using Zapier?


Hello!

I’m still new to Zapier and was wondering how to make it filter out things that aren’t really line items from Shopify and translate that to Airtable.

For Shopify, we had to use a third-party app for product customization, but it essentially makes an additional line item when the order comes through.

And I’m using Airtable as my production management system. So when an order comes through Shopify, I want Zapier to send it to Airtable, but if it’s a customization, I don’t want it to make a record because it isn’t a product:

I’m either trying to have Zapier filter out before sending the zap by saying “If the title of the line item says ‘Customization’, then don’t send the information; or, if it is easier, I am trying to have it say “If the line item has no SKU, then don’t send it to airtable.” I was trying to filter it out, but of course, the order has line items with SKUs in it, along with the one without a SKU, so it came through anyway.

What could I do to achieve this? Any help would be greatly appreciated!

Thank you so much!!

icon

Best answer by Troy Tessalone 5 October 2023, 20:49

View original

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

12 replies

Userlevel 7
Badge +14

Hi @ebefort-DDP 

Good question.

Can you help us have more context by posting screenshots with how your Zap steps are configured?

Userlevel 7
Badge +14

@ebefort-DDP 

Another option is to use an Airtable Automation with the Run Script step to delete records that match your conditions.

Hi, Troy! Thank you for replying to me!

I have not looked into Airtable Automations yet, so I’m not sure what script (or where) I would find one--if you have any advice on that, it would be great!

Here is what I have now:
 

Of course, I want only the line items with SKUs to be made in Airtable, but because the order itself has SKUs that exist with those customizations, it sends it all over to airtable.

Userlevel 7
Badge +14

@ebefort-DDP

Airtable provides example code to use in the Airtable Automation Run Script action.

 

// Delete a record in the Data table
let table = base.getTable("Data"); // Change this to the name or ID of your Table.
let query = await table.selectRecordsAsync({fields: []});

let recordId = query.records[0].id;

await table.deleteRecordAsync(recordId);

console.log("Deleted a record!");

 

Userlevel 7
Badge +14

@ebefort-DDP 

Otherwise, you’d have to use the Looping app to iterate over each Line Item in the Shopify Order.

Within the Loop you can add a Filter step.

Hi, Troy,

Thank you so much!!!

Regarding the looping, how would I go about implementing that? For example, I think I have this portion kind of figured out:

Then I tried to add that to the record creation:

But I was confused about which options to pick here:

Or would I even need the line item support for Airtable and only have the “Create Record” option?
I tried to make this work once, but it only added a single record; then I didn’t see where to add a filter in the loop itself, so I think I’m not fully understanding. Sorry to be such a pain! Thank you so much for helping me out!!!

Userlevel 7
Badge +14

@ebefort-DDP 

NOTES:

  • The Looping approach will run the Looping step and following steps within the Loop for each iteration (aka line item)
  • The Looping approach will use more Zap Tasks than using an Airtable Automation to delete records
  • The Airtable Create Record(s) option only supports a max of 10 line items

 

The Filter would be added as a Step between the Looping step and the Airtable step.

 

Make sure to fully review the help article for using the Looping app: https://help.zapier.com/hc/en-us/articles/8496106701453-Loop-your-Zap-actions

 

 

You are amazing!! That’s incredibly helpful!!

One last thing regarding the Airtable automation: I had it set up like the first time with the line items and I have the script in--which part of the script tells it to delete empty SKU records? It deleted some records, but I’m not sure which ones.

Do I need to locate it with “fields” and put “SKU” somewhere?

 

Is this it?

 

Thank you so much, Troy!!!!

Userlevel 7
Badge +14

@ebefort-DDP 

You can try these options:

  1. Try using a different Airtable Automation trigger (e.g. record matches conditions, record enters view where you configure Filter conditions)
  2. Add Conditional Logic to check the conditions

 

 

 

 

I will give that a shot then as well, thank you! You have been so amazing to someone so green like me!!