How to bulk get all inventoryItemIds from a store?

rank234
Excursionist
19 0 15

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 Expert
4610 54 531

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