Automating the import of images in a variant metafield (metafield type = file)

Automating the import of images in a variant metafield (metafield type = file)

FDevos
Visitor
2 0 2

Hi All, 

 

First post here, we are stuck on part of our import process. 

 

We are currently rebuilding our shopify stores, and as part of this rebuild, we are creating metafields to store some informations about our products. At every variant level, we want to have 3 metafields containing specific views of our products: 

- Image with dimensions (let's call it dimensional-image metafield)

- Swatch image (let,s call it swatch-image metafield. Basically a view of the finish or the product)

- A second view of our product (so that on hover on plp, we can show a secondary view of this specific variant) (Let's call it env-image metafield)

 

I know that manually, this is very easy. I create the metafield and after I can either go directly in each variant and fill the correct information (select or download a new picture). I could also go in the bulk editor to do it to all variants of a product at once. 

 

Issue is we have a LOT of products, and this would take an infinite amount of time to do. 

 

All our data is currently stores in a PIM called salsify. We are able to sync all product data and images to the shopify properties and metafield but we are unable to insert new images in this metafield automatically ? Looks like shopify is looking at referencing a file already in its library, but we don't know the name of the file, as shopify renames the files we send... 

 

Looking for ideas on how to solve this. 

 

Thank you ! 

Replies 4 (4)

Liam
Community Manager
3108 340 872

Hi FDevos,

 

Have you looked into the Bulk Operations API yet? It supports the setting of metafields, so this could be a suitable option for speeding up the import process.

As for the images, Shopify does indeed rename files upon upload. However, you can get the exact URL of the image via the Image object once it's been uploaded to Shopify. You can then use this URL when setting up your image metafields.

 

You may need to create a process where images are uploaded to Shopify first, then the URLs of those images are retrieved and used to create the image metafields. 

 

Hope this helps!

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Kalen_Jordan
Shopify Partner
689 27 113

Should be able to help you build out an automated workflow to handle this if you're interested with our app mesa!

FDevos
Visitor
2 0 2

Thank you I will have a look at this app. I am ready to test it but do you know what would the workflow look like ? 

Kalen_Jordan
Shopify Partner
689 27 113

Probably what I would do would be to see if we can connect to the salsify API with our API connector, and then figure out how you are associating products/variants within salsify to shopify, look up the correct variant in shopify and then push the metafield update through.

 

If you install the app and shoot me your salsify API details I could work on this for you.