Question

Change the Line Item Separator from comma to another character

  • 13 September 2023
  • 1 reply
  • 87 views

Userlevel 2
Badge

Hi all, this is a similar post to

I have a Shopify Integration with our CRM that posts the completed Purchases.

example data coming from Shopify:

  • Customer id: 0001
  • Receipt No: RCP001
  • Total Price: 100
  • Line Items Name: Item1 Name, Item2 Name
  • Customer id: 0002
  • Receipt No: RCP002
  • Total Price: 100
  • Line Items Name: Item1 Name, 250grams, Item2, 50grams

With the data above, I will post the purchase with the Line Item Names. Since Zapier automatically creates the comma separation, I will just use the .split(',') function to convert them into an array. But on this case, I will have a problem with Customer 0002 since the split function will recognize 4 records instead of 2. We do not have control over how our clients name their products so this is something we can’t avoid.

Is it possible to change the line items’ separator from comma to another reserved character?

example:

  • Line Items Name: Item1 Name, 250grams | Item2, 50grams

so that I’ll use .split('|') instead.

 

 


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

1 reply

Userlevel 7
Badge +14

Hi @ZapEm 

Good question.

Yeah nested line items are troublesome to deal with in Zaps.

The trick requires an advanced approach to get the raw JSON, then work with Code or AI to parse and prep the data.