What does this specific product look like when you bring it up in the Shopify web admin? Perhaps the images aren’t assigned at the variant level, just the “parent” product level. Here are screen shots of the Shopify web admin and the API call for a product that has its images assigned at the variant level. Looks okay implemented this way.
It seems regardless of how these products are configured I cannot get the necessary information from the API to properly link images to products and product variants.
If you’ve visually verified that these variants have images assigned to them, which appears to be the case, I’d suggest providing the Shopify request ID for one of these API responses, which appears in the header. That way a Shopify staff person can see what’s going on in their side. Strange!
I was unable to duplicate this behavior. I found a product in the Shopify web admin with variants. But no images associated at all. I first added an image via the Media section. Then I went into the first product variant and selected that image.
When I queried via the API, the variant_ids portion of the image collection contained the results as expected.
Screen shots below. I’m wondering if programmatically adding images via the API behaves differently than adding images via the Shopify web admin?
@CodeclockerDev what happens when you pull up the questionable product in the Shopify web admin? Pull it up and just append .json to end of the URL. That will show the raw JSON data for the product. If the variant_ids set is empty there too, then something funky must have happened assigning images in there I’m thinking. Screen shot of the example I provided in my last post.
I agree something seems weird here. The one piece that confuses me the most is that these images have been applied to these products for a while now but it seems that only recently i’ve started seeing this issue in the API response where as before I would get this info without any issue.
We’ll have to see what the Shopify team comes back with. Although maybe there’s some distinction between certain product variants that can assist their team in narrowing down what’s gone awry. For example, do some product variants with individually-assigned images provide the variant_ids set when you query them via the API? If you send a private message to one of the team members with the shop URL, a product variant ID that is handled correctly, and a product variant ID that isn’t handled correctly then I’d think that someone at Shopify can look deeper to see what’s happening.
Just want to make sure we’re on the same page here. For one of the products returning an unexpected empty variant_id array, please provide the product_id, along with a screenshot from the admin, showing the assigned images. Like this:
I’m not sure if something changed after your post, but I checked the product you provided and I didn’t see any assigned images on those variants (screenshot).
It’s worth mentioning that we rolled out new rich media options for products over the past months, so if something changed in the default behaviour for images it’s likely related to that. Can you provide more details about how you’re retrieving/ using this variant image data?
As well, I’m hoping you can help describe the specific behaviour you believe has changed here, because at this point I’m not exactly sure what’s changed. I just tested by creating a number of products in my test store with images and different numbers of variants, and can confirm that images are never automatically assigned to variants. Whether I create a product with 1 variant or 10, the images aren’t assigned to the variants until I explicitly assign them. If you’ve never manually assigned images in the past but used to see them in the variant_image response until recently, it’s possible the default image assignment behaviour has changed. Any info you can provide here will be helpful.