A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
Hi,
I'm trying to map the product gallery images to variants to generate ALT texts and filenames for the media image based on variant data. But the product media response returns MediaImage or ImageSource ids and variant image returns null or ProductImage id.
Am i missing something ? How do I know which MediaImage is attached to what Variant on the same product ?
GraphQL code I use (v2024-10):
query GetProducts($perPage: Int!, $cursor: String) { products(first: $perPage, after: $cursor, query:"published_status:published") { nodes { id handle media(first: 250) { nodes { id alt mediaContentType status preview { image { id url altText } } } } variants(first: 250) { nodes { id image { id } } } } } }