We need to query the expiration date and quantity of each product for our business needs.
Currently, we can see the Lots information on the product page.
The query expiration_lots API doesn’t provide the quantity, and the inventory API doesn’t provide the Lots information either.
How can we query the Lots information through GraphQL (EX: Quantity and Expiration Date…)?
Hello @jiasian! Currently, the best way to get that information is to query warehouse_products
. That query then has a connection to locations
that shows quantity and lot in each bin where the product exists.
Have a great day!
Thanks for your help.
It’s working !!
Hi, Just to jump in on this topic and ask an additional question. Should the “available” quantity for the warehouse product match the sum of all the location quantities?
The reason for the question is that in the following query most of the location “quantities” are showing as zero and having manually paged through the data using the before : cursor, the total quantity is not close to the “available” quanitity.
I am trying to query all product lots and their available quantities.
Thanks in advance.
Query I’m trying :
query warehouse_products(
$sku: String!
) {
warehouse_products(
sku: $sku
) {
request_id
complexity
data {
edges {
node
{
id
sku
on_hand
warehouse_id
active
allocated
available
locations(last:18) {
pageInfo{
hasPreviousPage
startCursor
}
edges{
cursor
node{
created_at
sku
quantity
expiration_lot{
name
}
}
}
}
}
}
}
}
}
Example response :
Hello @SteveAllen,
Sharing a couple of inventory concepts from our platform that will help you with the math
The on_hand
is the total sellable units in your possession.
The available
quantity is the on_hand minus the already allocated units to pending orders.
When you pick up those orders, inventory is moved out from the bins and into the totes. You can check this quantity in the in_tote
field.
The sum of the quantity in bins with sellable = true
plus the quantity in_tote
should amount to the same quantity as on_hand
Let me know if you have other doubts.
Have a great day!