Solved

Updating with productVariantUpdate with inventoryQuantities has no effect bulkOperationRunMutation

fpablogeronimo
Visitor
2 0 0

I am trying to update the quantity of a product variation in Bulk import data with the GraphQL Admin API (https://shopify.dev/api/usage/bulk-operations/imports)

I am supply only one of the supported GraphQL API mutations to the bulkOperationRunMutation at a time: productVariantUpdate.

 

mutation {
  bulkOperationRunMutation(
    mutation: "mutation productVariantUpdate($input: ProductVariantInput!) { productVariantUpdate(input: $input) { product { id } productVariant { id } userErrors { field message }}}",
    stagedUploadPath: "tmp/57428541610/bulk/06047023-7f7e-4c98-aca7-b2e033001ccd/bulk_op_vars") {
    bulkOperation {
      id
      url
      status
    }
    userErrors {
      message
      field
    }
  }
}

 

JSONL file in  tmp/57428541610/bulk/06047023-7f7e-4c98-aca7-b2e033001ccd/bulk_op_vars

 

{"input": {"id":"gid://shopify/ProductVariant/40953395314858","price":9536, "inventoryQuantities":{"availableQuantity":27,"locationId":"gid://shopify/Location/63249350826"}}}

 

Help!

Accepted Solution (1)

csam
Shopify Staff (Retired)
267 40 51

This is an accepted solution.

Hi @fpablogeronimo 

The endpoint that you're looking at is for importing bulk data only, not updating existing products. For updating your product variant inventory you'll want to use inventoryBulkAdjustQuantityAtLocation

You can read more about this here: 

https://shopify.dev/api/admin/graphql/reference/inventory/inventorybulkadjustquantityatlocation

 

To learn more visit the Shopify Help Center or the Community Blog.

View solution in original post

Replies 5 (5)

csam
Shopify Staff (Retired)
267 40 51

This is an accepted solution.

Hi @fpablogeronimo 

The endpoint that you're looking at is for importing bulk data only, not updating existing products. For updating your product variant inventory you'll want to use inventoryBulkAdjustQuantityAtLocation

You can read more about this here: 

https://shopify.dev/api/admin/graphql/reference/inventory/inventorybulkadjustquantityatlocation

 

To learn more visit the Shopify Help Center or the Community Blog.

lvorraro
Shopify Partner
7 0 8

Hi @fpablogeronimo @csam ,

 

I  have the same problem to update variant inventory quantity and i found inventoryBulkAdjustQuantityAtLocation.

The issue is:

If I need to update 50.000 inventory quantity (after a massive load of products), how can i use the service to update the inventory in bulk mode? How many items can I send into inventoryBulkAdjustQuantityAtLocation request? There is no limit described into API documentation.

The only limit that I have with bulk mutation is ONE BULK MUTATION AT TIME IN RUNNING, and with this limit I publish all products in one shot.

 

Thanks.

BenMurphySmith
Tourist
4 2 19

This solution is not correct and in fact is now a deprecated API call.

There are too many strange ways to update sets of InventoryItems (when you have an InventoryItem ID and a quantity) I'm guessing this is the supported one for the future for setting absolute "on hand" quantities:

https://shopify.dev/docs/api/admin-graphql/2023-07/mutations/inventorySetOnHandQuantities


But to make it even more confusing, there's this one that seems pretty damn similar for relatively adjusting quantities:
https://shopify.dev/docs/api/admin-graphql/2023-07/mutations/inventoryAdjustQuantities

 

All other methods are one-off adjustments or are deprecated. Shopify Staff please update the correct answer to this question. Bulk updates to inventory are a vital part of most stores operations, lack of clear guidance on how to do so makes this a real pain.

ftballguy45
Shopify Partner
32 0 11

This is so true. Another major area of functionality where Shopify is lacking. API team please give developers a solid way to update inventory numbers in bulk. How can you say its a serious e-commerce solution with no real way to sync inventory numbers

ShopifyDevSup
Shopify Staff
1432 234 488

Hi all,

 

We do not currently audit old posts, so make sure to check the posting date on any solution you see in a public forum, and keep in mind that Shopify's Admin APIs are versioned quarterly.

 

The third section of our guide on Managing inventory quantity and states has examples of when to use each of the current inventory mutations to set, adjust or move inventory quantities, but I will add a feature request on your behalf for our product teams to look into a bulk options as well. 

 

Thanks for adding your feedback about the Admin API's inventory mutations!

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog