Best answer

How to add multiple images when creating a new product in WooCommerce?

  • 30 May 2020
  • 6 replies
  • 967 views

Userlevel 1

As a product in wooCommerce is able to have multiple images in the image gallery, I have been trying to figure out how to add multiple images when creating a new product in wooCommerce using Zapier. 

 

I have attached a screenshot of the input option into wooCommerce in the Zap. It seems there is only an option to add the first image, but I have not been able to figure out how to add more than one image to a product. I tried inputting multiple URLs to the images using spaces and commas in the same input line but I get an error. 

 

Hope someone in the community has a solution to this. Would greatly appreciate the help. 

 

Thanks,

Nick

icon

Best answer by steph.n 11 August 2020, 06:25

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.

6 replies

Userlevel 7
Badge +8

Hi @Nick ,

Thanks for reaching out! I am going to send this to Support as they can take a look at your specific configuration and mapping to troubleshoot. 

Someone will be in touch just as soon as they can!

Userlevel 7
Badge +8

Hi there @Nick

It’s been a while but we wanted to check back on this issue. That's great that you were able to get in touch with Wes and Laurie from Zapier Support. We think the solution mentioned would be worth sharing to the rest of the community so here it is:

So, the way to get more than one image to populate in WooCommerce is by getting all the URLs you have and turning them into line items. You had the right idea earlier when you said you tried adding them separated by commas. Line items are very similar in structure: they are separated by commas and encased by [ ], so that the Zap knows we are sending more than one piece of content and it acts accordingly.

To do this, we'll need the following:

1. Get a new sample from the Google Sheets step that has more than one image.
2. Add a new step right after the Filter step using the Formatter app and a "Text to Line Items" transform.
3. Then, in the Input field of the Formatter, add all the fields where the image URLs appear, separated by commas.
4. Map the result of this step to the Image URL field in WooCommerce.

This will get all the URLs and turn them into a group of line items, which should allow WooCommerce to recognize each one.

 

And I understand you asked for clarification, so I’ve gone ahead and shared Laurie’s breakdown here:

 

So, the explanation on how the items are organized within a line item was just to help you understand how the Text to Line Item formatter does things, but the actual code that encases each item and the group is a bit more convoluted, so I think that's why it's not working as it is right now. We definitely need a Formatter step here to get these URLs in WooCommerce.

The way the Formatter works is that you map all the URLs into the "Input" field in the Formatter step, separating each URL with a comma, like so (this is one of my Zaps just for example):

9d60146fd1dc038ab4a7bce384d300c5.png
(view larger)

Then, when you test the step, it will turn each of these into a line item and create that group for you. Once that's done, you can map the result of the Formatter step in the Image "Src" field, in the WooCommerce step.

Hi @steph.n ,

I have the same problem. I want to send products from Airtable to Woocommerce. Airtable provides text with all image links separated by commas.

I tried your solution but got image error every time:

Error getting remote image

https://dl.airtable.com/.attachments/0ec8ff6c6d58ba70014d3c154c1e69fd/13f38d71/XXXXX.jpg,https://dl.airtable.com/.attachments/42ad5790481503b0119c0987c795eb68/0b4ff32c/XXXXXX.jpg,https://dl.airtable.com/.attachments/8e1a46b1b5855350309c40240c37b8c7/98e6aede/XXXXX.jpg,https://dl.airtable.com/.attachments/6ea563fd568a08d345e8cb081938ac37/58865710/XXXXX.jpg,https://dl.airtable.com/.attachments/d9a318d3d4c529e5a14373f2f404b8ae/b46b94cf/XXXX.jpg, ... 

Erreur : Bad Request
 

I manually tried several solutions:

[https://dl.airtable.com/.attachments/XXXXXX.jpg],[https://dl.airtable.com/.attachments/XXXXX01139AM.jpg]

or

[https://dl.airtable.com/.attachments/XXXXXX.jpg, https://dl.airtable.com/.attachments/XXXXX01139AM.jpg]

But nothing is working and I can't find any resources that can help me.

Thank you in advance,

Regards,

Roman

 
Userlevel 7
Badge +8

Hi @Romain G, I’m sharing the answer that @Nick received from Laura of Zapier Support:


The Text to Line Item formatter gets individual items and groups them using a format called "line items", which means there's specific code around them to ensure apps recognize those items are being part of the same group, so they'll cycle through them, adding all of them to the same field - like WooCommerce did with the image URLs. The way to know if you should use this is the following:

1. The field you need to pass to another app has more than one piece of content in it (or you'd like to use multiple pieces for the same field, like in this case)
2. The app you are trying to pass these informations is capable of dealing with line items - in Zapier steps this is represented by a border surrounding the field, like you have in the Image part of WooCommerce. All fields within that border can accept line items.

There are also cases where the trigger app already supports line items, and in these cases you can pass the data directly from one app to the other. One good example is Shopify: when an order has more than one product, all the products' information (price, quantity, name) come already formatted as line items, so you can just map the information directly from that step!

You can read more about line items here: https://zapier.com/help/create/basics/use-line-items-in-zaps

Hi

 

I would like to upload products from googlesheets to woocommerce using zapier. I have a link to image in google drive.

Error I am getting is “Invalid image: Sorry, this file type is not permitted for security reasons.”

Userlevel 7
Badge +11

Hi @Kev Gambi!

Looks like you’ve got a great conversation going with our Support team and they’re helping you out with this! If you have any further questions you can reply to that thread :)