Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

reference Document Issue

reference Document Issue

arnab1
Shopify Partner
25 0 2

I got an error when i try to update quantity on hand using GraphQL

Field 'referenceDocument' doesn't exist on type 'InventoryAdjustmentGroup
Replies 4 (4)

Liam
Community Manager
3108 344 904

Hi Arnab1,

 

Should you be using the referenceDocumentUri field for the InventoryAdjustmentGroup object? There does not appear to be a field for referenceDocument. 

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me 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

arnab1
Shopify Partner
25 0 2

hi @Liam ,

 

i want to bulk update quantity on hand on my product variant, how to update that using api?

Liam
Community Manager
3108 344 904

To update product variant inventory you'll need to get item IDs, location IDs and then set the inventory levels with this info:

 

Get the Inventory Item ID: First, you need to identify the `inventory_item_id` for each variant you want to update. You can obtain this from the Product Variant API with the endpoint: GET /admin/api/2023-07/products/{product_id}/variants.json


Get the Location ID: Inventory levels are associated with specific locations in Shopify with the Location resource. You'll need the ID of the location where you're adjusting inventory with this endpoint: GET /admin/api/2023-07/locations.json

 

Set the Inventory Level:

Once you have the inventory_item_id and location_id, you can set the inventory level for that item at that location with this endpoint: POST /admin/api/2023-07/inventory_levels/set.json


An example payload could be:

{
  "location_id": "your_location_id",
  "inventory_item_id": "your_inventory_item_id",
  "available": "new_quantity"
}


Replace your_location_id, your_inventory_item_id, and new_quantity with the appropriate values.

 

Hope this helps!

 

 

 

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me 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

arnab1
Shopify Partner
25 0 2

Hi @Liam ,

For using this inventory Level can i update bulk amount of product on hand quantity?