Ability to get breakdown of orders holding committed inventory count

Hello, I am in the process of building our private 3PL app shopify integration and I am trying to get the breakdown of Shopify’s committed quantity count by order like what is shown on Shopify admin, which is helpful to exclude inventory from orders not submitted to 3pl when doing inventory syncing, but it looks like the API that shopify admin dashboard uses is not a public API, is there any way to accomplish the same thing with public shopify graphql?

The API that admin panel uses is this:

query CommittedInventoryPopoverQuery($id: ID!) {
  inventoryLevel(id: $id) {
    id
    quantities(names: ["committed"]) {
      id
      quantity
      name
      activeLedgerDocuments(first: 25) {
        nodes {
          documentUri
          quantity
          displayName
          __typename
        }
        __typename
      }
      __typename
    }
    __typename
  }
}


{
  "id": "gid://shopify/InventoryLevel/138761765153?inventory_item_id=52347780628769"
}

and its response:

{
    "data": {
        "inventoryLevel": {
            "id": "gid://shopify/InventoryLevel/138761765153?inventory_item_id=52347780628769",
            "quantities": [
                {
                    "id": "gid://shopify/InventoryQuantity/138761765153?inventory_item_id=52347780628769&name=committed",
                    "quantity": 13,
                    "name": "committed",
                    "activeLedgerDocuments": {
                        "nodes": [
                            {
                                "documentUri": "gid://shopify/Order/6431070126369",
                                "quantity": 1,
                                "displayName": "#62744",
                                "__typename": "InventoryActiveLedgerDocument"
                            },
                            {
                                "documentUri": "gid://shopify/Order/6430229561633",
                                "quantity": 1,
                                "displayName": "#62503",
                                "__typename": "InventoryActiveLedgerDocument"
                            },
                            {
                                "documentUri": "gid://shopify/Order/6429867671841",
                                "quantity": 1,
                                "displayName": "#62377",
                                "__typename": "InventoryActiveLedgerDocument"
                            },
                            {
                                "documentUri": "gid://shopify/Order/6428611903777",
                                "quantity": 1,
                                "displayName": "#62072",
                                "__typename": "InventoryActiveLedgerDocument"
                            },
                            {
                                "documentUri": "gid://shopify/Order/6379796267297",
                                "quantity": 1,
                                "displayName": "#45919",
                                "__typename": "InventoryActiveLedgerDocument"
                            },
                            {
                                "documentUri": "gid://shopify/Order/6379400757537",
                                "quantity": 1,
                                "displayName": "#45848",
                                "__typename": "InventoryActiveLedgerDocument"
                            },
                            {
                                "documentUri": "gid://shopify/Order/6378643652897",
                                "quantity": 1,
                                "displayName": "#45685",
                                "__typename": "InventoryActiveLedgerDocument"
                            },
                            {
                                "documentUri": "gid://shopify/Order/6378158391585",
                                "quantity": 1,
                                "displayName": "#45612",
                                "__typename": "InventoryActiveLedgerDocument"
                            },
                            {
                                "documentUri": "gid://shopify/Order/6377548808481",
                                "quantity": 2,
                                "displayName": "#45469",
                                "__typename": "InventoryActiveLedgerDocument"
                            },
                            {
                                "documentUri": "gid://shopify/Order/6377507651873",
                                "quantity": 1,
                                "displayName": "#45467",
                                "__typename": "InventoryActiveLedgerDocument"
                            },
                            {
                                "documentUri": "gid://shopify/Order/6375849623841",
                                "quantity": 1,
                                "displayName": "#45135",
                                "__typename": "InventoryActiveLedgerDocument"
                            },
                            {
                                "documentUri": "gid://shopify/Order/6375437664545",
                                "quantity": 1,
                                "displayName": "#45082",
                                "__typename": "InventoryActiveLedgerDocument"
                            }
                        ],
                        "__typename": "InventoryActiveLedgerDocumentConnection"
                    },
                    "__typename": "InventoryQuantity"
                }
            ],
            "__typename": "InventoryLevel"
        }
    },
    "extensions": {
        "cost": {
            "requestedQueryCost": 10,
            "actualQueryCost": 8,
            "throttleStatus": {
                "maximumAvailable": 40000.0,
                "currentlyAvailable": 39992,
                "restoreRate": 2000.0
            }
        }
    }
}

but the activeLedgerDocuments which shows the breakdown of quantity committed by order is not available on the public api: inventoryLevel - GraphQL Admin

1 Like

Hey @Andrew_Jaanuu, just reading over your post. Would the on_hand state work better for your scnario? This total represents all inventory not yet shipped across the different states, so it should reflect the total number you would expect to have on hand in your warehouse at that point in time.

If you do need the orders associated with specific inventory states, you can use an orders query with filters to return the orders with those items that haven’t been fulfilled.

on_hand won’t work because that quantity from the warehouse that we try to match what’ on shopify includes other unavailable inventory in addition to inventory reserved for orders together with available inventory.

Thanks for clarifying that. In this case, currently the orders query would be how you can get the specific order details.

how can I make the order query to return the orders associated with specific inventory states being equivalent to the CommittedInventoryPopoverQuery above?

Here’s an example of query fields that would return orders that contain a specific sku that should match the committed inventory.

query: "fulfillment_status:unfulfilled AND status:open AND sku:16615192"

While you’re testing this, I recommend adding in the syntax debugging headers to help verify the queries are being parsed as intended.

@Andrew_Jaanuu have you found a solution for this?
I have a similar issue where I need to know the breakdown of Shopify’s safety stock. The problem is that when I call the inventory level GraphQL I get the total safety stock and not split per 3rd party app.

In admin shopify is using this query:

query UnavailableInventoryPopoverQuery($id: ID!) {
  inventoryLevel(id: $id) {
    id
    quantities(
      names: [
        "available",
        "committed",
        "incoming",
        "on_hand",
        "reserved",
        "damaged",
        "safety_stock",
        "quality_control"
      ]
    ) {
      id
      name
      quantity
      ledgerDocumentQuantities(ledgerDocumentUris: ["id://AdminChange"]) {
        ledgerDocumentUri
        quantity
        __typename
      }
      activeLedgerDocuments(first: 21) {
        nodes {
          documentUri
          quantity
          displayName
          __typename
        }
        __typename
      }
      externalQuantityByApp {
        app {
          id
          icon {
            id
            url
            __typename
          }
          title
          apiKey
          installed
          installation {
            id
            launchUrl
            __typename
          }
          __typename
        }
        quantity
        __typename
      }
      __typename
    }
    reservedMovementQuantities(first: 3) {
      edges {
        node {
          movementId
          movementName
          quantity
          __typename
        }
        __typename
      }
      pageInfo {
        hasNextPage
        __typename
      }
      __typename
    }
    __typename
  }
}

But the following fields do not exist in the Shopify Graphql schema:

  • ledgerDocumentQuantities
  • activeLedgerDocuments
  • externalQuantityByApp
  • reservedMovementQuantities

Any idea on how to know the safety stock per ledgerDocumentUris" ?

Hey @Tiago_Ramalho, our team is working on improving our inventory management API’s. We’ve recently offered some guidance on working with the referenceDocumentUri in inventory adjustments.

There are still limitations on the API as you’ve noted that we are aware of.

Hello @KyleG-Shopify

Thanks for the quick response. The guide seems more around mutation during the adjustment, we have been using it for some time already. But what about when querying the inventory level?

Is there any way to get that information from the API ?

Currently you can only narrow this down to the name, not a specific app or reference URI Manage inventory quantities and states