Inconsistent variant position in graphql api

I’m using the below query to pull variant data for my app’s customers, and I’m noticing some inconsistencies in the position field of the variant.

{
productVariants (first: 250) {
edges {
node {
id
product {
id
}
title
price
compareAtPrice
selectedOptions {
name
value
}

inventoryItem {
tracked
}
inventoryPolicy
inventoryQuantity
position

image {
id
altText
url
}
}
}
}
}{
productVariants (first: 250) {
edges {
node {
id
product {
id
}
title
price
compareAtPrice
selectedOptions {
name
value
}

inventoryItem {
tracked
}
inventoryPolicy
inventoryQuantity
position

image {
id
altText
url
}
}
}
}
} 

Here is one of the nodes I get in the response.

{
"node": {
"id": "gid://shopify/ProductVariant/47567565979926",
"product": {
"id": "gid://shopify/Product/9143958077718"
},
"title": "Default Title",
"price": "0.00",
"compareAtPrice": null,
"selectedOptions": [
{
"name": "Title",
"value": "Default Title"
}
],
"inventoryItem": {
"tracked": true
},
"inventoryPolicy": "DENY",
"inventoryQuantity": 0,
"position": 2,
"image": null
}

This is the only variant returned for my product, but the position field is ‘2’. I’d expect the position field to be set to 1 based on the documentation.

Is this a problem that anyone else has been seeing? Is it possible there’s a bug with the API for getting variants?

Is this happening for all products where their is only 1 variant? Did this product previously have multiple variants?

This is for a brand new product with no variants.

I have also seen cases where this inconsistent positioning happens when a product has multiple variants. In that case, there were two variants with positions of 2 and 3. I’m not certain if there was another variant in the past.

Digging into this with our API team.

1 Like

Any answer here @Liam ? I’m seeing a similar effect where a brand new product (without any created variants) gets a default variant with position=2.