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
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024