How to bulk get all inventoryItemIds from a store?

How to bulk get all inventoryItemIds from a store?

rank234
Excursionist
20 0 18

I have a lot of products and want to get all the inventoryItemIds from my store so I can use them for other operations.  Is there an easy way to do this?

Reply 1 (1)

HunkyBill
Shopify Partner
4853 60 558

Yes! Yes there is an easy way to do this. Here is the easiest way I know.

mutation{
  bulkOperationRunQuery(
    query:"""
        {
        products { 
         edges {
           node {
            id
             variants {
               edges {
                 node {
                   inventoryItem {
                     id
                   }
                 }
               }
             }
           }
         }
        }
      }
    """
  ) {
    bulkOperation {
      id
      status
    }
    userErrors {
      field
      message
    }
  }
}
Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com