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?