Discuss all the new features introduced with the new product model in GraphQL.
I'm trying to delete variants with an option value following this thread. I want to use the variantStrategy of MANAGE to delete an option value and the related variants. The doc states that:
If an option value is deleted, all variants referencing that option value will be deleted.
But it gives me an error in the Shopify GraphiQL App:
{ "data": { "productOptionUpdate": { "userErrors": [ { "field": [ "optionValuesToDelete", "0" ], "message": "Cannot delete an option value that is currently associated with a variant with the selected variant strategy.", "code": "OPTION_VALUE_HAS_VARIANTS" } ], } } }
Why does the
My graphql:
mutation updateOption($productId: ID!, $option: OptionUpdateInput!, $optionValuesToDelete: [ID!]) { productOptionUpdate(productId: $productId, option: $option, optionValuesToDelete: $optionValuesToDelete) { userErrors { field message code } product { id options { id name values position optionValues { id name hasVariants } } variants(first: 5) { nodes { id title selectedOptions { name value } } } } } }
My input variable:
{ "productId": "gid://shopify/Product/7917543227547", "option": { "id": "gid://shopify/ProductOption/10157249953947" }, "optionValuesToDelete": [ "gid://shopify/ProductOptionValue/3185625858203" ], "variantStrategy": "MANAGE" }
Why is the variantStrategy not working? The error message ("Cannot delete an option value that is currently associated with a variant with the selected variant strategy.) seems like contradicts the variantStrategy mentioned in the doc
Solved! Go to the solution
This is an accepted solution.
Hi, there
you missing one param in your graphql input , see below pic
This is an accepted solution.
Hi, there
you missing one param in your graphql input , see below pic