Best answer

I get the incorrect format when importing less or more than 3 line items in a Shopify order

  • 25 November 2022
  • 5 replies
  • 66 views

Userlevel 1
Badge

Hi there, hoping someone can help me with this formatting issue in zapier. I am automatically importing orders in from Shopify into google sheets. The default is for them to import like this: “Item 1, Item 2, Item 3”. My initial goal was to get them to import like this all in the same cell:

 

Item 1

Item 2

Item 3

 

I successfully did this with the line-item to text utility. See solution below:

 

So all good it seemed, until there are less or more than 3 items in an order. When there are more than 3 items, it only imports the first 3, and when there are less than 3 items, it imports to google sheets like this:

Any solutions? Thanks so much in advance.

icon

Best answer by Todd Harper 26 November 2022, 07:26

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.

5 replies

Userlevel 6
Badge +8

Hi @Eric Caldwell!

Welcome to the Zapier Community!

I’d recommend a Code by Zapier step, with a Javascript event set up as in the screenshot (using the copy/paste code below):

var input = inputData.input;

var output = input.replace(/,\s/g, "\n");

output = [{output}];

As you can see from the below screenshots, it works with any number of line items (so long as they don’t have a comma followed by a space in their name.

 

Userlevel 1
Badge

Thanks so much for the reply. Any idea why this isn’t working?

 

 

Userlevel 6
Badge +8

Oh, in your first example, there were spaces between each element. In this case, delete the \s from the code, and you should be set!

Userlevel 6
Badge +8

@Eric Caldwell Were you able to try this out?

Userlevel 1
Badge

I sure did! Thanks so much for the help