API Request:
curl -X POST \
https://xyz.myshopify.com/admin/api/2024-04/graphql.json
-H ‘Content-Type: application/json’
-H ‘X-Shopify-Access-Token: xyz’
-d ‘{
“query”: “mutation updateOption($productId: ID!, $option: OptionUpdateInput!, $optionValuesToAdd: [OptionValueCreateInput!], $optionValuesToUpdate: [OptionValueUpdateInput!], $optionValuesToDelete: [ID!]) { productOptionUpdate(productId: $productId, option: $option, optionValuesToAdd: $optionValuesToAdd, optionValuesToUpdate: $optionValuesToUpdate, 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 } } } } } }”,
“variables”: {
“productId”: “gid://shopify/Product/8274219860276”,
“option”: {
“id”: “gid://shopify/ProductOption/10495573262644”,
“position”: 1,
“name”: “Size”,
“values”: [“749766 302|14”, “749766 302|13.5”, “749766 302|15”, “749766 302|13”, “12”, “13”, “14”]
}
}
}’
please let me know if I am missing anything.
API Response :
{“errors”:[{“message”:“Variable $option of type OptionUpdateInput! was provided invalid value for values (Field is not defined on OptionUpdateInput)”,“locations”:[{“line”:1,“column”:40}],“extensions”:{“value”:{“id”:“gid://shopify/ProductOption/10495573262644”,“position”:1,“name”:“Size”,“values”:[“749766 302|14”,“749766 302|13.5”,“749766 302|15”,“749766 302|13”,“12”,“13”,“14”]},“problems”:[{“path”:[“values”],“explanation”:“Field is not defined on OptionUpdateInput”}]}}]}
