Access a community of over 900,000 Shopify Merchants and Partners and engage in meaningful conversations with your peers.
I am testing and building a headless shopify using gatsby-shopify-starter template. (developing in React)
As far as I know I can easily query all the product and collection information with the help of 'gatsby-source-shopify'.
However I am having trouble using Storefront API, specially creating a customer using mutation.
I used gatsby-source-graphql plugin to build the admin graphql schema :
{
resolve: `gatsby-source-graphql`,
options: {
typeName: 'ShopifyAdmin',
fieldName: 'admin',
url: `https://storedomain.myshopify.com/admin/api/2021-07/graphql.json`,
headers: {
'X-Shopify-Access-Token': process.env.SHOPIFY_SHOP_PASSWORD,
},
fetchOptions: {
method: 'POST',
},
},
}
My question is: How would you be able to use mutation to the https://fingersuit-japan.myshopify.com/admin/api/2021-07/graphql.json Do I need to install and use apollo client in order to use mutation?
Already tested with GraphiQL app and with Insomnia the following GraphQL query:
mutation customerCreate($input: CustomerCreateInput!) {
customerCreate(input: $input) {
customerUserErrors {
code
field
message
}
customer {
id
}
}
}
Now how am I able to do this in my headless shopify-gatsby app using React? Are there any guides for it?
User | RANK |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |