Previously we used the product api to query all products in our store, we would get variant_ids returned for the variants that shared that image file.
Recently I'm noticing that the variant_ids array is always empty when I know for a fact that cannot be the case
nothing on our end has changed, yet magically this information is not present on the response.
Has something changed that i'm not aware of? How else are we able to retrieve our product/product variant images?
This screams "BUG" to me, so please help me resolve this issue as it has become urgent for me and my organization.
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.
Here is a link to show how products look in shopify: https://monosnap.com/file/zVkbkQoiYMGsIKEfbgfMWuSu7DlVfQ
Even when using the default title variant (default variant for a product that does not have any additional variants added to it) the id is empty.
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!
Just paste it into this thread and someone from Shopify should see it. If they reviews logs on their end I think they can see what's going on perhaps.
Are you sure those variants have images assigned? Images live on the product object, and are optionally assigned to individual variants.
Yes, I can see in my product section the base product + variants all have an image but does not return the id in the API response.
Another case is when there is only the "Default Title" variant which seems to be the default variant for all products. It seems in the past I would get a variant_Id for the Default Title image as well but that does not appear to be the case either.
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.
Here is the json for the maximind product, which has an image and a Default Title but no variant_ids shown here:
Here is the json with the other product that does have variants. Each variant and base item share the same image but these are all empty as well:
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.
Sorry to be a pain guys but is there any update? This is impacting our business severely and just want to see what might be going on.
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.
I unfortunately do not have an example of such behavior. It seems that these ids are always empty no matter what.
I guess i'll wait to see if the requests Id I sent was enough to help @_JB debug the issue.
I really appreciate your help @Gregarican it is great to see a partner going out of their way to help support these types of technical issues.
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.