'The Following Image IDs Do Not Exist Or Do Not Belong To The Product"

Solved

'The Following Image IDs Do Not Exist Or Do Not Belong To The Product"

Harelk1015
Shopify Partner
38 1 6

REPOST FOR THE CURRECT PLACE FOR THE POST

 

Im creating a new product with the rest api like this : 

 

const product = new shopify.api.rest.Product({ session: res.locals.shopify.session });
product.title = productResponse.title;
product.body_html = productResponse.body_html;
product.vendor = productResponse.vendor;
product.product_type = productResponse.product_type;
product.images = productResponse.images;
product.image = productResponse.image;
product.options = productResponse.options;
product.variants = productResponse.variants;
product.created_at = productResponse.created_at;
product.handle = productResponse.handle;
product.published_at = productResponse.published_at;

product.tags = productResponse.tags;
product.published = true;

await product.save({
update: true,
});

So i already have a full product object that im just pasting into my store, but when i send the request i get back this error :  'The following image IDs do not exist or do not belong to the product: 40075820597538,40075820564770,40075820859682'

does anyone know whats the cause? i tried to match the imageId of the variants to the images in the "images" field but still doesnt work
Accepted Solution (1)
Harelk1015
Shopify Partner
38 1 6

This is an accepted solution.

The solution i found was:

As i said i "stole" a product from a different store so it already had imageId's and everything.
so what i needed to do was the remove the imageId from each variant and then after the product is created i put the new created id in place

View solution in original post

Replies 11 (11)

Liam
Shopify Staff
2873 312 820

Hi Harelk1015,

 

The error message you received indicates that the image IDs you provided in the `images` field of the product object do not exist or do not belong to the specific product. This might be happening due to a mismatch between the image IDs and the images associated with the product.

To troubleshoot this issue, you can follow these steps:

  1. Double-check the image IDs: Verify that the image IDs you are using in the `images` field correspond to valid image IDs of the product. Ensure that the image IDs are accurate and belong to the same product you are creating.
  2. Check image associations: Confirm that the images you are referencing in the `images` field are associated with the product. If the images you are trying to assign are not already associated with the product, you need to create the association by uploading the images or referencing existing images using their image IDs.
  3. Verify image existence: Ensure that the images referenced by the image IDs actually exist in your Shopify store. If any of the referenced image IDs are invalid or have been deleted, you will need to update the product object with valid image IDs.

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

Harelk1015
Shopify Partner
38 1 6

This is an accepted solution.

The solution i found was:

As i said i "stole" a product from a different store so it already had imageId's and everything.
so what i needed to do was the remove the imageId from each variant and then after the product is created i put the new created id in place

Liam
Shopify Staff
2873 312 820

Can you use the product import CSV file to update variant image IDs? 

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

Harelk1015
Shopify Partner
38 1 6

sorry, can you explain more plese?

Liam
Shopify Staff
2873 312 820

You can specify variant images in the upload products CSV so you could update variant images that way. 

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

Hornsandtails
Visitor
1 0 0

Having the same error, need clarification... 

 

I've made my own mock images but when I delete the stock images provided by printful, then fo to make changes in the description, it says The following image IDs do not exist or do not belong to the product.

 

Prior to deleting the initial mocks this error does not appear when saving the description. I've tried re uploading the template many times the same thing happens. 

 

I've changed the names to a similar name as the origional file names from Printful but I am still getting the same error. Even if I down load the origional photos from printful and just upload those images I get the error. If i delete all the photos I get the error....

 

So I simply cant change the description if I delete those origional photos so im stuck having to use them? 

Harelk1015
Shopify Partner
38 1 6

I managed to fix the issue by adding the product, and then editing the product and adding the images

friendoftheroot
Shopify Partner
48 5 8

Correct.


Programmatically you would need to fetch all variants of a product via GET.
Then assign the referenced image id to null via PUT.
Payload looks like this:
{ "variant": { "id": 4733234164, "image_id": null } }

Relaxacia
Tourist
3 0 2

Hey Liam, How do i find, view and delete existing variant image ID's?

Liam
Shopify Staff
2873 312 820

If you're using the GraphQL API, you could use the ProductVariant.media connection to get variant image IDs and then use the productDeleteMedia mutation to delete the images. 

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

nannu-123
Shopify Partner
2 0 0

i am also create product using rest api like this 

const product = new shopify.api.rest.Product({ session: session });
product.title = req.body.title ? req.body.title : flashostProduct.title;
product.body_html = flashostProduct.description;
product.vendor = flashostProduct.estore_name;
product.status = 'active';
product.images = [
{
id: '2685',
path: '65fde139bd00ffe54abcb7be057e77cd.jpg',
product_id: '97'
},
{
id: '2686',
path: 'f76d942fea31cee62d49bf0ca9c8e378.jpg',
product_id: '97'
}
],
// flashostProduct.product_images
product.variants = variants
product.options = transformedData;
product.tags = `flashost-product, id:${flashostProduct.estore_id}`;
product.vendor_id = flashostProduct.estore_id;
But when product create it doesnot show images how can i solve this issue