If one or more images of a product have been added to its variants, then "variant_ids": [] in the response remains empty. See the screenshots below.
How to reproduce:
- create a product
- add an image to the product
- create variants and add the image to the variants
- GET /admin/api/2019-10/products/#{product_id}/images.json and/or GET /admin/api/2019-10/products/#{product_id}/images/#{image_id}.json
product with variants
Get all product images
Get a single product image by id
Hello Heiko_Woywodt,
We have understand your problem varient_id:[]. because of if image source is null or invalid for varients then varient_id will be null.
For more details we can go through below link:
https://help.shopify.com/en/api/reference/products/product#create-2019-10 https://help.shopify.com/en/api/reference/products/product-image#show-2019-10
Thanks for your answer! I do not understand why the image source should be null or invalid for variants.
The product and the variants are created via the shopify backend. Also the image upload and the image assignment to the variants was done via the shopify backend manually.
In the meantime I have found a proof that this is bug and also a workaround for it. ;-)
If you execute the call without the field parameter (.../admin/api/2019-10/products/4298011246627/images.json) then "variant_ids" : [] is empty/null .
If you execute the call with the fields parameter (...admin/api/2019-10/products/4298011246627/images.json?fields=id,product_id,position,variant_ids) then the assigned variants to the image are listed in "variant_ids" : [30972269428771,30972269494307] are listed. See the screenshots below.
Product Image Rest call with fields parameter
Product Image Rest call without fields parameters
User | Count |
---|---|
14 | |
9 | |
7 | |
7 | |
6 |