Skip to main content
Best answer

Shopify Tax Line Items Loop Workaround


Forum|alt.badge.img

So I’ve got a Zap that loops line items from Shopify orders. It mostly works as expected, except for the tax lines, which I believe is a slight bug / limitation of the way the looping works and I’m wondering if anyone has a good workaround?

As you can see in the screenshot below, my data gets input into the loop correctly (loop_values). But then when it comes to actually loop it, the line.home.tax isn’t looped and neither is the line.local.tax. I believe this is because that data comes from a loop within a loop - the data structure looks like this:

line items > 1 (first loop) > tax_lines > 1 (second loop) > price_set > shop_money > amount

As you can see, there’s a loop within a loop there with tax_lines also potentially having multiple lines (although in my case there’s actually only one line there). It only happens to tax_lines because the other data structure looks like this:

line items > 1 (first loop) > price_set > shop_money > amount

There’s only 1 loop. So I believe Zapier is getting confused with line items within line items and looping the wrong one for the tax_lines. I believe this to be a bug / limitation of the way Zapier works with line items, but is there a workaround? Nest loops might do it, but that isn’t allowed on Zapier.

 

Best answer by Alex_Gillon

I ended up having to use a Formatter to subtract 1 from the loop iteration, which makes it start at 0 instead of 1.

Then I used another Formatter to split the tax values out and only output the corresponding loop, like the below:

 

View original
Did this topic help you find an answer to your question?

3 replies

ken.a
Forum|alt.badge.img+6
  • Zapier Staff
  • 6324 replies
  • January 27, 2025

Hi ​@Alex_Gillon,

I just came across your post here and wanted to check in here to see how you’re getting on. Were you able to resolve the issue that you’re encountering here?

Please do let us know if you’re still in need of some help on this at all - happy to assist further! 🙂

 


Forum|alt.badge.img
  • Author
  • Beginner
  • 4 replies
  • Answer
  • January 27, 2025

I ended up having to use a Formatter to subtract 1 from the loop iteration, which makes it start at 0 instead of 1.

Then I used another Formatter to split the tax values out and only output the corresponding loop, like the below:

 


ken.a
Forum|alt.badge.img+6
  • Zapier Staff
  • 6324 replies
  • January 28, 2025

That’s awesome ​@Alex_Gillon! Thank you for sharing the workaround here!

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