Liquid, JavaScript, themes, sales channels
Hello! Our public app fetches the webp version of product images via GraphQL transformedSrc, However, couple of weeks ago we noticed that a lot of images returned from the produced url are still in their original format, based on their content-type, eg: images/jpg
When i investigate the docs I found out the transformedSrc is being deprecated, as per this page:
https://shopify.dev/api/admin-graphql/2021-10/objects/image#fields-Image-OBJECT
"The location of the transformed image as a URL.
All transformation arguments are considered "best-effort". If they can be applied to an image, they will be. Otherwise any transformations which an image type does not support will be ignored. Use url(transform:) instead"
Is this the reason for the transformation not working?
When i tried to use url, I got error message that Image does not implement url field.
Can any of you help me solve this? How to avoid the deprecation?
Thank you
Is this the reason for our failure?
Link for
I've noticed this deprecation warning too in multiple places, e.g.:
(This is from the GraphiQL in-app docs when using the Admin API version 2021-10.)
It says use `url` instead, but url is not a field on Image. Can't find anything on an url field in the docs on shopify.dev either.
Public Apps | Theme customization & App development
- Was my reply useful? Like it to let me know!
- Did I answer your question? Please mark as Accepted Solution.
- Need more help? Contact us.
As the docs suggest, you need to use the transform.
So something like this:
featuredImage{
url(transform:{preferredContentType: PNG})
}
There's a few things you can do with the transform, so take a look at the docs link to see what you can use.
Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024Digital marketers and app developers have tracked activity in apps and websites for yea...
By Ollie Mar 13, 2024February was an exciting month with Shopify Editions, informative webinars, and more! F...
By JasonH Mar 7, 2024