skip to Main Content

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


  1. Turn on customer accounts in your Shopify Admin. If they are turned off, then it makes sense that you cannot create a customer.

    Login or Signup to reply.
  2. 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

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search