Checking Items Stock quantity

If the item stock is set to 0 or it does not set from the square admin then how to get the stock data from the Inventory api.

Actually stock data only gets returned if it is set to some positive value greater than 0 but if it is not set or is equal to 0 then how can we get that data.

I’m not sure what you mean, here. When I do RetrieveInventoryCount I definitely see stock counts less than 0. Can you clarify what you’re seeing on your end? Do you have example variation ids that are not returning the count?

I am using this api endpoint.

https://connect.squareup.com/v2/inventory/{item_variation_id}?location_ids={location_id}

But it is returning an empty object.

Eg: {}

But if any item stock is set to some positive value greater than 0 then it is returning the object with info like.

Eg:

{
“counts”: [
{
“catalog_object_id”: “{object_id}”,
“catalog_object_type”: “ITEM_VARIATION”,
“state”: “IN_STOCK”,
“location_id”: “{location id}”,
“quantity”: “100”,
“calculated_at”: “2021-02-08T06:06:40.286Z”
}
]
}

Hm, strange. Can you share the object id? I just tested moving my stock to exactly 0, and was able to get it in the response:

        {
            "catalog_object_id": "CYK72BPFX2RKIQXRRTCBJGLL",
            "catalog_object_type": "ITEM_VARIATION",
            "state": "IN_STOCK",
            "location_id": "7270VTEWZABAJ",
            "quantity": "0",
            "calculated_at": "2021-02-09T21:37:12.299Z"
        }

Yes sure please check these object ids:

FWYCUVRX5E2ZPP536OBMITZ4
JMKFV4W4UFC75HFX4W27BJDO
QLUPQO5R4PDK6VAGQOXOMRVQ

All these object ids are returning empty object. Please check them.

Thanks

So looking at the first object: FWYCUVRX5E2ZPP536OBMITZ4, I see that it doesn’t have inventory tracking enabled, and it has never had any stock, so I wouldn’t really expect there to be a response, since it’s never actually “been counted”.

ok sjosey i got your point.

Thanks for helping us out.

1 Like