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
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:
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.
Did you ever get a response on this? I am running into the same issue and seems nobody either from shopify directly or a community member has not responded.
Have you created a collection on your online store and experienced an issue with adding yo...By Ollie Aug 24, 2022
Connect your PayPal account to allow your customers to checkout using the PayPal gateway a...By Ollie Jul 28, 2022