A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
I'm trying to create a product with a default variant using productSet, but the below results in an option being defined, rather than the 'hidden' default option for a product with no variants/options.
It appears if you pass in 'Title' and 'Default title' it interprets these as actual options, not as a default option
mutation createProductAsynchronous($productSet: ProductSetInput!, $synchronous: Boolean!) {
productSet(synchronous: $synchronous, input: $productSet) {
product {
id
}
productSetOperation {
id
status
userErrors {
code
field
message
}
}
userErrors {
code
field
message
}
}
}
{
"synchronous": false,
"productSet": {
"title": "GraphiQL Product 3",
"status": "ACTIVE",
"variants": [
{
"optionValues": [
{
"optionName": "Title",
"name": "Default title"
}
],
"price": "9.99",
"compareAtPrice": "10.99"
}
],
"productOptions": [
{
"name": "Title",
"values": [
{
"name": "Default title"
}
]
}
]
}
}
Solved! Go to the solution
This is an accepted solution.
PEBCAK solution on this one 😅
The correct value is related to capitalisation - it needs to be "Default Title" not "Default title" - to generate a default variant
This is an accepted solution.
PEBCAK solution on this one 😅
The correct value is related to capitalisation - it needs to be "Default Title" not "Default title" - to generate a default variant