# Get total count of warehouse products

**URL:** <https://community.shiphero.com/t/get-total-count-of-warehouse-products/898>\
**Category:** GraphQL API\
**Created:** [October 14, 2020, 4:42am UTC](https://community.shiphero.com/t/get-total-count-of-warehouse-products/898 "2020-10-14T04:42:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![supritha](https://avatars.discourse-cdn.com/v4/letter/s/73ab20/32.png) [@supritha](https://community.shiphero.com/u/supritha)\
**Post date:** [October 14, 2020, 4:42am UTC](https://community.shiphero.com/t/get-total-count-of-warehouse-products/898/1 "2020-10-14T04:42:03Z")

</div>

Hi,

Is there a way to get total products count for each warehouse?

I need to fetch all products which are available in a given warehouse. To enable pagination, I need to know the total count because in the query I can’t just give random number as it is directly affecting credits.

```
query {
  warehouse_products(warehouse_id: "V25d67ZWhvdXNlOjY0ODIx") {
    request_id
    complexity
    data(first: 500) {
      edges {
        node {
          id
          account_id
          on_hand
          inventory_bin
          reserve_inventory
          reorder_amount
          reorder_level
          custom
          warehouse {
            id
            dynamic_slotting
            profile
          }
          product {
            id
            name
            sku
          }
        }
        cursor
      }
    }
  }
}

```

Though this warehouse is having only 2 products if I give **first :500** in the query, it is taking 501 credits(If I give first:2 only 3 credits are required).

Please do let me know if there is a way to find the total count of products for each warehouse?

Thanks in advance!  
Supritha

---

<div class="post-metadata">

**Author:** ![galvarez](https://avatars.discourse-cdn.com/v4/letter/g/d2c977/32.png) [@galvarez](https://community.shiphero.com/u/galvarez)\
**Post date:** [October 14, 2020, 3:33pm UTC](https://community.shiphero.com/t/get-total-count-of-warehouse-products/898/2 "2020-10-14T15:33:24Z")

</div>

Hello @supritha I checked on the docs and API schema does not show a field with the total count of products on each warehouse.

---

<div class="post-metadata">

**Author:** ![supritha](https://avatars.discourse-cdn.com/v4/letter/s/73ab20/32.png) [@supritha](https://community.shiphero.com/u/supritha)\
**Post date:** [October 15, 2020, 5:58am UTC](https://community.shiphero.com/t/get-total-count-of-warehouse-products/898/3 "2020-10-15T05:58:55Z")

</div>

@galvarez,

Thanks for the reply!

---

<div class="post-metadata">

**Author:** ![supritha](https://avatars.discourse-cdn.com/v4/letter/s/73ab20/32.png) [@supritha](https://community.shiphero.com/u/supritha)\
**Post date:** [October 15, 2020, 6:00am UTC](https://community.shiphero.com/t/get-total-count-of-warehouse-products/898/4 "2020-10-15T06:00:00Z")

</div>

Is there any work around? Since it is directly affecting the credits.

---

<div class="post-metadata">

**Author:** ![tomasw](https://sea2.discourse-cdn.com/flex020/user_avatar/community.shiphero.com/tomasw/32/248_2.png) [@tomasw](https://community.shiphero.com/u/tomasw)\
**Post date:** [October 26, 2020, 2:23pm UTC](https://community.shiphero.com/t/get-total-count-of-warehouse-products/898/5 "2020-10-26T14:23:08Z")

</div>

Hi @supritha!  
We don’t have a query to get the number of total products beforehand. For that purpose, you will need to use [cursors and pagination](https://developer.shiphero.com/graphql-primer/#pagination) until you see **hasNextPage** :false.

On the other hand, you could also use the inventory snapshot if that helps: [https://developer.shiphero.com/inventory-snapshot/](https://developer.shiphero.com/inventory-snapshot/)  
That way you can get all the products from a warehouse all in one query with its inventory.

Thanks again!  
Tom
