Im new to GraphQL and this example only sure a basic example which is great. Sadly they have not provided an example of a product show page; how to fetch a single product.
Using GraphiQL:
{
product(id: "gid://shopify/Product/1245678") {
title
description
onlineStoreUrl
}
}
I seem to get the data. I, getting an error ““GraphQL error: Field ‘product’ doesn’t exist on type ‘QueryRoot’” which is wrong because “product” in on the QueryRoot”.
My actual code:
const query = gql`
query {
product(id: "gid://shopify/Product/4416592838700") {
title
description
onlineStoreUrl
}
}
`;
// Then later:
graphql(query),
[...]
Is anyone looking at this? The example is hidden important things such as the “bodyHtml” and fetch a single product. They having not included that query as it does not work. How do you mean: “GraphQL error: Field ‘bodyHtml’ doesn’t exist on type ‘Product’” when it is there? Could a member of staff please advice???