Knowledge Center

How to Update Product Options in Product Variants in Shopify?

This has been a common issue that many of you have encountered lately. And it is entirely understandable, as updating product options in product variants as options fields in GraphQL and Rest API are altogether different.

However, you can follow the standard procedure;

Step 1 – Login to your Shopify Admin panel

Step 2 – Go to the products

Step 3: Click on the product’s name with the variant name you would like to change.

Step 4 – Make appropriate changes in the variant details

Step 5 – Click to Save

Or else, you can follow this method where;

We are updating product variants using GraphQL. Here, our primary goal is to send three different options (large, blue, and paper) to the product variant to convert it into one single variant with only one [String!] value. Also, in REST APIs, it consists of three different options (Option1, Option2, and Option3) with unchanged default titles.

You can consider the below links:

Update Product Variant: https://shopify.dev/docs/admin-api/graphql/reference/mutation/productvariantupdate?api[version]=2020-04

Update Product: https://shopify.dev/docs/admin-api/graphql/reference/mutation/productupdate?api[version]=2020-04

Well, it actually takes an array of strings ([String!]), not a single string value. So you need to pass it like that [“Large”, “Blue”, “Paper”], see detailed mutation request below:

Query


mutation productVariantUpdate($input: ProductVariantInput!)
{
productVariantUpdate(input: $input)
{

product {
id
title
handle
}

productVariant {
id,
selectedOptions {
name,
value
}
}
userErrors {
field
message
}
}
}

 

Variables


{
"input": {
"id": "gid://shopify/ProductVariant/12386472609940",
"options": ["Small", "Medium", "Large"]
}
}

Share
Manthan Bhavsar

Manthan Bhavsar is the one of the most brilliant go-to people, when someone thinks to Hire Shopify Certified Experts! A techie by profession and a technologically driven person by passion, Manthan Bhavsar aren’t shy to blog and share the knowledge he has with the world. If you want to follow Manthan, you can do so on Facebook, Twitter, and LinkedIn.

Published by
Manthan Bhavsar

Recent Posts

Figma to Shopify – Know How You Can Covert Figma Design to Shopify?

Gone are those days when developers and enterprises surge around limited prototype options while working… Read More

1 week ago

Top 10 Agile Project Management Tools and Software in 2022!

To all the project coordinators and managers out there, we know how challenging it is… Read More

2 weeks ago

Step-by-step Instructions to Connect Your YouTube Channel to Shopify!

Have you ever heard about brand collaboration? I am sure you must have. Well, a… Read More

3 weeks ago

Learn How to Display Products Catalogue on The Homepage in Magento 2!

Do you know why entrepreneurs and enterprises are investing highly in UI/UX development and developers… Read More

4 weeks ago

NFTs Explained – Definition, Usage and Working Procedure!

If you are a tech-savvy or digital content lover, you must have heard of the… Read More

4 weeks ago

Key Feature & Update Highlights of Shopify Editions 2022 – Connect to Consumer!

In a technological advancement and rapidly growing digital marketplace, consumers have enormous shopping options. However,… Read More

1 month ago