Create variant values
Use the Create variant options mutation to create a variant value for an option. This provides an option to create variant values for options. The values can either be plain text or color. For example, if color is required, a hex code for the color is passed in the mutation.
EXAMPLE-- For Variant option Finish, use this mutation to create values like Silver, Gold, White. Also, for users to view this color on the storefront, provide hex code ex- Silver is #C0C0C0
Mutation
mutation($input:AddProductVariantOptionValueInput!){
addProductVariantOptionValue(input: $input){
product {
id
variantOptions {
code,
name {
locale,
value
}
values {
code,
name {
locale,
value
},
hexcode,
secondaryInformation {
locale
value
}
}
defaultValue {
code
name {
locale
value
}
hexcode,
secondaryInformation {
locale
value
}
}
}
}
userErrors {
... on UserError {
__typename
message
path
}
}
}
}
Was this page helpful?
Tell us more…
Help us improve our content. Responses are anonymous.
Thanks
We appreciate your feedback!