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
Find Global Growth Opportunities For Your Business with Shopify AcademyLearn how to exp...
By Shopify Feb 4, 2025Hey Community, happy February! Looking back to January, we kicked off the year with 8....
By JasonH Feb 3, 2025Expand into selling wholesale with Shopify Academy’s learning path, B2B on Shopify: Lau...
By Shopify Jan 28, 2025