How can I use the API to upload a common image to all products?

Jedi_Lofty
Shopify Partner
7 0 0

I have an app that uploads products from our database, with between 1 and 10 images.

 

We want all products to have an additional image as the last image, and want this stored in the CDN with the idea that, if it needs changing, we could modify the file in the CDN and have it affect all the products without needing to reupload 

 

I've uploaded a test image to the CDN to try it, but when I add it to a product using the productUpdate API it is effectively using the CDN file and creating a copy of it - changing the file in the CDN does nothing to the image on the product.

 

I could only find three parameters in the new "media" section, which I'm populating as follows:

 

media:
[
  {
    alt: "My Alt Text"
    mediaContentType: IMAGE
    originalSource: "https://cdn.shopify.com/s/files/PATH_TO_IMAGE"
  }
]

 

Is there a way for me to achieve what I want to do using the API?

Replies 3 (3)

gr_trading
Shopify Partner
1755 142 187

Hi @Jedi_Lofty ,

 

Shopify product don't point to any third-party image links, when we update image using CSV or API.

 

Shopify download that image to our server and create a new file with different name, therefore your idea of providing the image.

 

I don't think will work.

 

However to achieve this you can create a metafield at product level and assign this CDN URL in that.

 

Now edit the theme template so that theme able to show the image.

 

Hope this will help...

For any custom development WhatsApp or connect at Email ID: gr.trading15@gmail.com for quick consultation. | Shopify Free codes
To support Buy Me a Coffee
Jedi_Lofty
Shopify Partner
7 0 0

Thank you for your reply.

 

I thought about doing that, but I have not been able to find a way to add the image into the product images.  We want it to appear at the end of the product images as a thumbnail so that a customer can click it and see the full version in the same area as the other product images.

gr_trading
Shopify Partner
1755 142 187

This can be done using custom dev in theme in media-gallery file for product page.

 

Let me know if you need our service to implement the same.

 

Request you to connect over the WhatsApp, if interested.

For any custom development WhatsApp or connect at Email ID: gr.trading15@gmail.com for quick consultation. | Shopify Free codes
To support Buy Me a Coffee