Hi Daniel
You are correct. A product with no variants has a single default variant. This is so that when you add to cart you add the product variant id.
For example if you’re using GraphQL in the following:
{
products(first : 100) {
edges {
node {
variants(first: 10) {
edges {
node {
id
}
}
}
}
}
}
}
You add the variant id to the cart. In the above you would do a map in JS to add each variant id if there are many.
For example if you’re using React you do
function handleAddToCart() {
products.edges.node.variants.edges.map(item => addVariantId(item.variant.id))
}
If the product only has one variant (the default one) it’s like so:
function handleAddToCart() {
products.edges.node.variants.edges[0].node.id // => single variant
}