Hi,
I have an issue with the productSet mutations, i try to create a product with two variants (example) and use the linkedMetafields .
But this doesn’t work and continue to give me error ; i also follow the documentation at this link but doesn’t work.
This is my request :
mutation createProductAsynchronous($productSet: ProductSetInput!, $synchronous: Boolean!) {
productSet(synchronous: $synchronous, input: $productSet) {
product {
id
title
options(first: 5) {
name
position
optionValues {
name
}
}
variants(first: 10) {
nodes {
price
selectedOptions {
name
optionValue {
id
name
}
}
}
}
}
userErrors {
code
field
message
}
}
}
{
"productSet": {
"title": "T-Shirt Example",
"productOptions": [
{
"name": "Colore",
"linkedMetafield": {
"namespace": "shopify-color-pattern",
"key": "color"
}
}
],
"variants": [
{
"optionValues": [
{
"optionName": "Colore",
"linkedMetafieldValue": "gid://shopify/Metaobject/111804973254"
}
],
"price": "29.99",
"sku": "TSHIRT-PURE",
"barcode": "0123456789012"
},
{
"optionValues": [
{
"optionName": "Colore",
"linkedMetafieldValue": "gid://shopify/Metaobject/111804973254"
}
],
"price": "29.99",
"sku": "TSHIRT-LINEN",
"barcode": "2109876543210"
}
]
},
"synchronous": true
}
The error returned :
{
"data": {
"productSet": {
"product": null,
"userErrors": [
{
"code": "OPTION_VALUES_MISSING",
"field": [
"input",
"productOptions",
"0"
],
"message": ‘Colore’ must specify at least one option value."
}
]
}
},
"extensions": {
"cost": {
"requestedQueryCost": 66,
"actualQueryCost": 50,
"throttleStatus": {
"maximumAvailable": 20000,
"currentlyAvailable": 19950,
"restoreRate": 1000
}
}
}
}