Using the storefront api with graphql-yoga server. Got the playground open to test queries and mutations.
According to the documentation this should work for creating a customer
mutation {
customerCreate(
input: {
firstName: "dave",
lastName: "smith",
email: "[email protected]",
password: "HiZqFuDvDdQ7",
acceptsMarketing: true
}
) {
customer {
id
firstName
lastName
email
}
customerUserErrors {
field
message
}
customer {
id
}
}
}
However this returns an error
{
"data": {
"customerCreate": null
},
"errors": [
{
"message": "Customer accounts are disabled.",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"customerCreate"
]
}
]
}
Can anyone help
2
Answers
Turn on customer accounts in your Shopify Admin. If they are turned off, then it makes sense that you cannot create a customer.
I’ve the same issue and fix it by updating the admin setting for checkout, as the screenshot.
The reason is that the customer accounts is set by default with "Don’t use accounts". You should change it to "Accounta are optional" or "Accounts are required."
offical link: https://help.shopify.com/en/manual/checkout-settings/customer-accounts