Update quantity for variants with fulfillment service location

I used the mutation for setting quantities for product with fulfillment service location.

mutation inventorySetOnHandQuantities($input: InventorySetOnHandQuantitiesInput!) { inventorySetOnHandQuantities(input: $input) { userErrors { field message } inventoryAdjustmentGroup { createdAt reason referenceDocumentUri changes { name delta } } } }
 
Variables:
{
  "input": {
    "reason": "correction",
    "referenceDocumentUri": null,
    "setQuantities": [
      {
        "quantity": 2399,
        "locationId": "gid://shopify/Location/99253289248",
        "inventoryItemId": "gid://shopify/InventoryItem/50738918031648"
      },
      {
        "quantity": 2383,
        "locationId": "gid://shopify/Location/96594264352",
        "inventoryItemId": "gid://shopify/InventoryItem/50738921275680"
      }
    ]
  }
}

But I got the error that LOCATION_NOT_FOUND.
What is the problem? And how can I solve this?

Hello,

There are a couple of things I’d like to point out for you.

The inventorySetOnHandQuantities mutation has been deprecated in 2024-07 and it has been replaced with a new mutation inventorySetQuantities introduced in 2024-07. The new mutation is quite similar, but has a few more capabilities; such as the ability to also set available quantities and has compareQuantity functionality.

The error for inventorySetOnHandQuantities that I believe you’re getting is INVALID_LOCATION.

I found two reason you would be receiving that error for the input.

The first location is active but it is associated with a fulfillment service with inventoryManagement set to true. When inventory is set with inventoryManagement to true, this is an indication that Shopify will reach out to the callback url to fetch_stock and update inventory that way, but you can’t adjust the inventory with Shopify. There are more details specified on this page.

On that admin, if you view the product details or variant details for and item stocked at a location for a fulfillment services with inventory management set to true, you will notice that you can’t adjust inventory at that location.

The second location specified has been deleted.

Let me know if that helps

Christine

1 Like

Thanks @cbella and Christine,

Your answer helps me a lot.

But, as I know that, the version 20240-4 will be applied from the beginning of the next year, 2025.

And, currently, I wanna update the workflow updating the quantity of products, from my development app, using GraphQL in 2024-04 version API.

The mutation inventorySetQuantities , it will be used for version 2024-07, it’s so far.

As your recommend, I turned off inventoryManagement, set it to false, and then use the inventorySetOnHandQuantities mutation for updating quantity, I received another error

{
     "field": [
         "input",
         "setQuantities",
         "0",
         "locationId"
     ],
      "message": "The specified inventory item is not stocked at the location."
}

I used another mutation is inventoryBulkToggleActivation for activating inventory item in this location ( the location associated with fulfillment service), and I got the NOT_FOUND location

"userErrors": [
        {
          "field": [
            "inventoryItemUpdates",
            "0",
            "locationId"
          ],
          "message": "The quantity couldn't be updated because the location was not found.",
          "code": "LOCATION_NOT_FOUND"
        }

So, currently, I wonder that how can I update quantity of products from my app to Shopify, with fulfillment service location?