App reviews, troubleshooting, and recommendations
I am trying to create a variant-level product bundle with the GraphQL API, but I am getting an error which implies that the documentation does not match the requirements of the field.
As you can see here, the mutation expects input to be of type ProductInput:
mutation CreateProductBundle($input: ProductInput!) { productCreate(input: $input) { product { title variants(first: 10) { edges{ node{ id price } } } } userErrors{ field message } } }
And the example shared shows an example of input as:
{ "input": { "title": "The Hair And Skin Bundle", "variants": [ { "price": 10 } ] } }
However, when I check the ProductInput object, it doesn't have a field called 'variants' https://shopify.dev/docs/api/admin-graphql/2024-07/input-objects/ProductInput
When I try to run the mutation with my $input taking the same shape as the given example, I get this error:
{"errors":[{"message":"Variable $input of type ProductInput! was provided invalid value for variants (Field is not defined on ProductInput)","locations":[{"line":2,"column":38}],"extensions":{"value":{"title":"Test","variants":"{\"price\":10}"},"problems":[{"path":["variants"],"explanation":"Field is not defined on ProductInput"}]}}]}
which is not unexpected because variants does not exist in the ProductInput object.
Ref: https://shopify.dev/docs/apps/build/product-merchandising/bundles/add-variant-fixed-bundle
We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024Thanks to everyone who participated in our AMA with 2H Media: Marketing Your Shopify St...
By Jacqui Sep 6, 2024The Hydrogen Visual Editor is now available to merchants in Shopify Editions | Summer '...
By JasonH Sep 2, 2024