App reviews, troubleshooting, and recommendations
I've been going in circles trying to figure out why my code is receiving response 200 and my product is created yet all options after the first in the array are ignored. My submission is as follows:
mutation { productCreate(input: {title: "test productCreate run 1", descriptionHtml: "<h1>Test Product via productCreate</h1><p>some text here</p>", tags: "test,productCreate,tags1", status: DRAFT, productOptions: [{ name: "Colour", position: 1, values: [ { name: "Green" }, { name: "Red" }, { name: "Blue" }, { name: "Purple" } ] }, { name: "Holes", position: 2, values: [ { name: "No hole" }, { name: "1 Hole" }, { name: "2 Holes" } ] }] }){ product { id } } }
I receive the product ID back correctly yet when I view the product in my admin I only see:
All my other options on both sets are ignored entirely. There are other similar posts to this but not in the correct forum sections and their questions have zero answer ( https://community.shopify.com/c/shopify-discussions/latest-admin-graphql-api-not-working-properly/m-... )
Can anyone chime in as to why I get zero errors yet clearly have errors or something is going wrong at the gateway side. Thank you.
Solved! Go to the solution
This is an accepted solution.
I tried your graphql, and also the example here:
It seems you must have a variant for the product with those options before they are visible, they are created on the product, but in the UI you cannot see them until you have options with those values.
mutation CreateProductWithOptions($input: ProductInput!) {
productCreate(input: $input) {
userErrors {
field
message
}
product {
id
options {
id
name
position
values
optionValues {
id
name
hasVariants
}
}
variants(first: 5) {
nodes {
id
title
selectedOptions {
name
value
}
}
}
}
}
}
This is an accepted solution.
I tried your graphql, and also the example here:
It seems you must have a variant for the product with those options before they are visible, they are created on the product, but in the UI you cannot see them until you have options with those values.
mutation CreateProductWithOptions($input: ProductInput!) {
productCreate(input: $input) {
userErrors {
field
message
}
product {
id
options {
id
name
position
values
optionValues {
id
name
hasVariants
}
}
variants(first: 5) {
nodes {
id
title
selectedOptions {
name
value
}
}
}
}
}
}
First of all thank you for the response. I have tested as outlined and requested a response of the option / values to indeed see the options I submit are there...
I find that to be seriously annoying going around in circles looking at admin simply because the UI doesn't display all options that don't have variations , maybe ( and I doubt it ) they should change that to display such options greyed out to indicate their presence but disabled due to no variation. That would make way more sense.
I agree
Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024In today’s interview, we sat down with @BSS-Commerce to discuss practical strategies f...
By JasonH Nov 13, 2024