A GraphQL call to the admin API InventoryItem query endpoint returns outdated data. We have been able to reproduce this issue across multiple development stores, on 2 consecutive days.
Scenario:
- Through the Shopify admin web UI, we edit the
Country/Region of originfield for a singleproductVarianton a product with 3productVariantsin total,- we change the value from Netherlands (NL) to United Kingdom (GB),
- We query the GraphQL admin API
InventoryItemendpoint (see query ‘A’ and response below), - We notice the change is not listed; the
updatedAtshows an old date, - We query the GraphQL admin API
productVariantendpoint (see query ‘B’ and response below) with theInventoryObjectnode included, - We notice the change is listed; the
updatedAtshows the new date.
We are stumped by this behaviour, and are forced to conclude this is some sort of error?
Any help in getting this fixed would be most appreciated.
GraphQL query A:
{
inventoryItem(id: "gid://shopify/InventoryItem/44087721754782") {
id
sku
updatedAt
variant {
id
sku
}
countryCodeOfOrigin
provinceCodeOfOrigin
}
}
GraphQL query A response:
{
"data": {
"inventoryItem": {
"id": "gid://shopify/InventoryItem/44087721754782",
"sku": "SMSL-13847-OC-M",
"updatedAt": "2022-09-05T19:33:31Z",
"variant": {
"id": "gid://shopify/ProductVariant/41989857607838",
"sku": "SMSL-13847-OC-M"
},
"countryCodeOfOrigin": "NL",
"provinceCodeOfOrigin": null
}
},
"extensions": {
(...)
}
}
GraphQL query B:
{
productVariant(id: "gid://shopify/ProductVariant/41989857607838") {
id
sku
updatedAt
inventoryItem {
id
sku
updatedAt
countryCodeOfOrigin
provinceCodeOfOrigin
}
}
}
GraphQL query B response:
{
"data": {
"productVariant": {
"id": "gid://shopify/ProductVariant/41989857607838",
"sku": "SMSL-13847-OC-M",
"updatedAt": "2022-09-03T12:42:05Z",
"inventoryItem": {
"id": "gid://shopify/InventoryItem/44087721754782",
"sku": "SMSL-13847-OC-M",
"updatedAt": "2022-09-06T08:55:56Z",
"countryCodeOfOrigin": "GB",
"provinceCodeOfOrigin": null
}
}
},
"extensions": {
(...)
}
}
note: while the queries shown above have been run in the ‘Shopify GraphiQL App’, we get the same results when querying directly from our own server.