Computed field help
Hi guys! I'm trying to write a computed field on shopifyShop to check the amount of missing product alt texts in the store.
I had this in the past but now that it changed to product media I'm not being able to write it. Can you help?
15 Replies
Hello,
ShopifyFile has an alt field. I think that you should be able to use that.

You might have to check the mimetype though
You can probably use the startsWith function to see if the mimetype starts with
image
Can you write a quick example? I tried but I suck at gelly honestly
I need it to be exclusively product images not any images
That's why I mentioned product media
the filter should probably check that productId is set and that the mimetype starts with image
Great thank you
and obviously that alt isnt set
Hi @Chocci_Milk, any ideas?

You need to specify that alt is on file
We tried a lot of things but cannot link file with product
field on shopifyShop {
productMedia {
file {
count(id, where: (isNull(alt) || alt == "") && startsWith(mimetype, prefix: "image"))
}
}
}
Not sure how to check if the file is associated with a product using gelly
Tried multiple approaches
What I wrote is what you should be using at base
Your filters are incorrect and should always target the model: ie
files.alt
Do you only want productMedia or do you also want productVariantMedia?All images associated with a product or variant
If you check the image I tested what you wrote or at least tried haha
Yeah so productMedia is only on the product. That's why I was going by file