Bulk Operations - Fetch InventoryLevels for all stores?

Solved
Highlighted
Excursionist
37 1 6

Hi All,

Is it possible to create a Bulk Operation with inventory levels for all stores? Currently, I've only been able to get it working for one specific store at a time.

Here's my mutation:

mutation {
  bulkOperationRunQuery (
    query: """
    {
      inventoryItems {
        edges {
          node {
            id
            inventoryLevel (locationId: "gid://shopify/Location/{LOCATION_ID}") {
              available
              id
              updatedAt
            }
          }
        }
      }
    }
    """
    ) {
      bulkOperation {
        id
        status
      }
  userErrors {
    field
    message
    }
  }
}



Thanks!

0 Likes
Highlighted
Shopify Staff (Retired)
Shopify Staff (Retired)
624 102 119

This is an accepted solution.

Hey @Conner ,

 

When you mention fetching inventory levels for all stores, do you mean for all locations in which the inventory items can be stocked? If that is the case, then I believe this is the GraphQL Bulk Operations query you need to run:

 

 

mutation {
  bulkOperationRunQuery(
   query: """
   {
  inventoryItems {
    edges {
      node {
        id
        inventoryLevels {
          edges {
            node {
              location {
                address {
                  address1
                  address2
                  city
                  country
                }
                id
              }
              available
              id
              updatedAt
            }
            
          }
        }
      }
    }
  }
  }
    """
  ) {
    bulkOperation {
      id
      status
    }
    userErrors {
      field
      message
    }
  }
}

 

 

 

Hassain | Developer Support Specialist @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

0 Likes
Highlighted
Excursionist
37 1 6

Thanks so much, @hassain ! That's exactly what I was looking for.

0 Likes
Highlighted
New Member
2 0 0

Thanks!

0 Likes