Usually variant has only one image so this is how to fetch it:
{
products(first: 20) {
edges {
node {
variants(first: 5) {
edges {
node {
image {
id
originalSrc
}
}
}
}
id
title
}
}
}
}
However, if an app lets you use more than one which means they can use one of the following methods:
- Merge the multiple images to one image - so if you download this image you will see all images inside of it
- Use the liquide API and inject the src's into your html - so the graphQL dont have this info unless you use the graphQL to fetch the html injected (Im not sure it is possible) but anyway it is more complicated and risky to you because every template has different html
if you want a full nodeJS example:
const query = `{
products(first: 20) {
edges {
node {
variants(first: 5) {
edges {
node {
image {
id
originalSrc
}
}
}
}
id
title
}
}
}
}`
const response = await axios({
headers: {
"Content-Type": "application/json",
"X-Shopify-Access-Token": store.accessToken
},
method: "post",
data: {
query
},
url: `https://${store.domain}/admin/api/2020-07/graphql.json`
});