Given this simple query to get the first ten products:
query {
products(first: 10) {
edges {
node {
id
title
}
}
}
}
How would I get their variants in the same query?
Given this simple query to get the first ten products:
query {
products(first: 10) {
edges {
node {
id
title
}
}
}
}
How would I get their variants in the same query?
You need to add variants into the query just like you did for products
query {
products(first: 10) {
edges {
node {
id
title
variants (first: 10) {
edges {
node {
id
sku
barcode
}
}
}
}
}
}
}
Thank you.
Here is a version of the answer is that is not painful to read:
query {
products(first: 10) {
edges {
node {
id
title
variants (first: 10) {
edges {
node {
id
sku
barcode
}
}
}
}
}
}
}