How to Get Warehouse Location for Product?

Hi community!

We are trying to get the location bin for an specific product id.

Currently we are trying this way (example request id: 61bcca2c4206ad2ac7fb6fe1):

query {
product(id:“XXX”) {
request_id
complexity
data {
id
legacy_id
account_id
name
sku
created_at
updated_at
warehouse_products {
warehouse_id
warehouse_identifier
on_hand
inventory_bin
inventory_overstock_bin
reserve_inventory
replenishment_level
reorder_amount
reorder_level
custom
}
tags
}
}
}

The problem is that the returned “inventory_bin” doesn’t match the warehouse location bin.
Any ideas?

Hello @jrico!
Thank you for reaching out!

You are not getting the right bin in the response because your account is set up as Dynamic Slotting, and those two fields are exclusively for Static Slotting.

For dynamic Slotting, this is how you can get the correct bins the product is in:

query {
  product(id: string) {
    request_id
    complexity
    data {
      id
      legacy_id
      account_id
      name
      sku
      created_at
      updated_at
      warehouse_products{
        warehouse_id
        warehouse_identifier
        on_hand
        reserve_inventory
        replenishment_level
        reorder_amount
        reorder_level
        custom
        locations(first:5){
          edges{
            node{
              quantity
              location{
                name
              }
            }
          }
        }
      }
      tags
    }
  }
}
  • I’m using first: 5 to save on credits, but you can use any other number.
  • You can address many more fields for each location. If you are using a GraphQL specific Client, you will get the whole schema. If you don’t, let me know, and I can help you out.

Please let me know if this doesn’t help.

Have a great day!
TomasFD

1 Like