Ad

Shopify Graphql CustomerCreate

- 1 answer

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

Ad

Answer

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

Ad
source: stackoverflow.com
Ad