Mutation ProductVariant, update price & stock qty with one request

Maaax
New Member
1 0 0

Hello,

I want to update the inventory and price of a product variant on one request.

This is my GraphQL mutation :

 

mutation{
            ProductVariant0: productVariantUpdate(input: {
              id: "VARIANT_ID",
              price: "500",
              inventoryQuantities : 
              {
                locationId: "gid://shopify/Location/111111",
                availableQuantity: 1
            },
            }){
              productVariant{ id, price }
            },
        }

The response status is 200 but the inventory level does not update.
Any solution ?

0 Likes
vix
Shopify Staff
Shopify Staff
534 105 103

Hey @Maaax 

Have you gone through the tutorial here? https://shopify.dev/tutorials/manage-product-inventory-with-admin-api this explains indepth how to get the inventory item ID and update inventory, as well as the relationship between inventory + variants 

Vix | Developer Support @ 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

0 Likes