The GraphQL inventoryItem endpoint gives an incorrect result when the query parameter is used to query the updated_at field with a :> (= greater than or equal) operator.
More specifically, the date part of the date-time string is honoured, but the time part is ignored.
As a result, queries with date-time values of 2023-04-14T00:00:00Z and 2023-04-14T23:59:59Z (and anything in-between) all give the same result.
Hey @Jacco-V , thanks for getting in touch. This is a tricky one - definitely get where you’re coming from here. To resolve this issue, you can enclose the date-time value inside single quotes (') for the query parameter to work as expected. Here’s an example inventoryItems query with the updated_at value inside quotes:
query getInventoryBetween {
inventoryItems(first: 10, reverse: true, query: “updated_at:>=‘2023-04-14T23:59:59Z’”) {
nodes {
id
locationsCount
legacyResourceId
duplicateSkuCount
variant {
availableForSale
id
}
updatedAt
}
}
}
This would pull the record correctly based on the time stamp. There’s an example here in our dev docs on this that goes over search syntax - just including this here for reference.
Hope this helps - thanks again for getting in touch.
Al | Shopify Developer Support
1 Like