Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
If I have a product that has options of "Size" with "Small, Medium, and Large" and "Color" with "Blue, Red, Yellow, White, and Black"
I want to return: "Size - Small, Medium, Large" and "Color - Blue, Red, Yellow, White, Black".
I have been able to return the product option and all variant combinations with the below code.
This returns: "Size, Color" and "Small, Blue" - "Small, Red" - "Small, Yellow" - "Small, White" - "Small, Black" - "Medium, Blue" - "Medium, Red" - "Medium, Yellow" - "Medium, White" - "Medium, Black" - "Large, Blue" - "Large, Red" - "Large, Yellow" - "Large, White" - "Large, Black".
Is there any way to return the first response instead of the second?
{
productByHandle(handle: "${productHandle}") {
options{
name
}
variants(first: 50) {
edges {
node {
selectedOptions{
name
}
}
}
}
}
}