Homechevron_rightBlogchevron_righte-commercechevron_rightHow to Update Product Variant Options in Shopify (GraphQL API Guide)
bookmarke-commerceFeatured Guide

How to Update Product Variant Options in Shopify (GraphQL API Guide)

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. 1st Step – Log in to your Shopify Admin panel 2nd Step […]

Manthan BhavsarManthan BhavsarEditoreventJun 22, 2022schedule2 min read
How to Update Product Options in Product Variants in Shopify?

Update Options in Product Variants in Shopify is something many developers need to do. 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.

Steps to Update Options in Product Variants in Shopify

1st Step Log in to your Shopify Admin panel

2nd Step – Go to the products

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

4th Step – Make appropriate changes in the variant details

5th Step – 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 value. Additionally, in REST APIs, it consists of three different options (Option 1, Option 2, and Option 3) with unchanged default titles.

You can consider the following links:

Update Product Variant: productVariantsBulkUpdate API

Update Product: productUpdate mutation

Well, it actually takes an array of strings (), 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"] } }

Tags#how to updating product options in product variants?
Share this article
Manthan Bhavsar

About the author

Manthan Bhavsar

Manthan Bhavsar is a technology consultant at Metizsoft Solutions with over 14+ years of experience in eCommerce development, platform migration, and building high-risk and compliance-heavy online stores. He has helped brands across regulated industries move between platforms including Shopify, WooCommerce, and Magento without losing data or search rankings.

You might also like

Leave a Reply

Be the first to comment

Comments are reviewed before publishing.