Hi, I'm pretty new to Shopify and Hydrogen.
I am trying to figure out the best approach for MediaGallery to display both product and variant images, while prioritising the selected variant's images in the gallery:
- Utilise the
useProductVariants() and useSelectedVariant() hooks to access variant data.
- Convert variant images to
MediaImage and concatenate them with the product images (MediaImage), while ensuring that duplicate images are removed based on their Shopify CDN file url. This is necessary since variant and product images may have different IDs? (gid://shopify/ProductImage/* vs. gid://shopify/ImageSource/*), but the URLs are identical for the same image.
Not too sure about this, any suggestions?
Thank you.