Using GraphQL, when I query an existing Variant with productVariants based on barcode, it returns Variant’s data with no problems.
Query:
query VariantsStocksQuery($query: String!, $first: Int = 1) {
productVariants(query: $query, first: $first, reverse: false) {
pageInfo {
endCursor
hasNextPage
hasPreviousPage
startCursor
}
nodes {
barcode
title
sku
id
}
}
}
Variables
{"query": "barcode:
But, if you manually delete the Variant's Product from Shopify backoffice and recreate it, when you redo the above graphql query to fetch the same barcode, with input first: 1, **it returns no result, with NextPage = True and no Cursor**
Result:
```javascript
{
"data": {
"productVariants": {
"pageInfo": {
"endCursor": null,
"hasNextPage": true,
"hasPreviousPage": false,
"startCursor": null
},
"nodes": []
}
},
"extensions": {
"cost": {
"requestedQueryCost": 12,
"actualQueryCost": 2,
"throttleStatus": {
"maximumAvailable": 2000,
"currentlyAvailable": 1998,
"restoreRate": 100
}
},
"search": [
{
"path": [
"productVariants"
],
"query": "barcode:7700000089724",
"parsed": {
"field": "barcode",
"match_all": "7700000089724"
}
}
]
}
}
Now, if you redo the query with First=2, it will return the variant’s data.
If I repeat the manual deletion of the same Product and redo the Query with First=2 , it will give no results,
but it will return you the variant’s data with First=3, and so on.
My speculation is that when deleting a Product, it’s variants are actually ‘deleted’, but a “trash” entry still remains in the Shopify storage.
This is a very annoying bug and it could be bypassed easily using the Cursor. But avail, in this scenario the Cursor is NULL while we have a next page.
Thank you for your time