mutation customerCreate($input: CustomerCreateInput!) {
customerCreate(input: $input) {
customer {
firstName
lastName
email
phone
acceptsMarketing
}
customerUserErrors {
field
message
code
}
}
}
curl -X POST \
https://your-development-store.myshopify.com/api/2025-01/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Storefront-Access-Token: {storefront_access_token}' \
-d '{
"query": "mutation customerCreate($input: CustomerCreateInput!) { customerCreate(input: $input) { customer { firstName lastName email phone acceptsMarketing } customerUserErrors { field message code } } }",
"variables": {
"input": {
"firstName": "John",
"lastName": "Smith",
"email": "johnsmith@shopify.com",
"phone": "+15146669999",
"password": "5hopify",
"acceptsMarketing": true
}
}
}'
const { storefront } = await unauthenticated.storefront(
'your-development-store.myshopify.com'
);
const response = await storefront.graphql(
`#graphql
mutation customerCreate($input: CustomerCreateInput!) {
customerCreate(input: $input) {
customer {
firstName
lastName
email
phone
acceptsMarketing
}
customerUserErrors {
field
message
code
}
}
}`,
{
variables: {
"input": {
"firstName": "John",
"lastName": "Smith",
"email": "johnsmith@shopify.com",
"phone": "+15146669999",
"password": "5hopify",
"acceptsMarketing": true
}
},
},
);
const data = await response.json();
const client = new shopify.clients.Storefront({
domain: 'your-development-store.myshopify.com',
storefrontAccessToken,
});
const data = await client.query({
data: {
"query": `mutation customerCreate($input: CustomerCreateInput!) {
customerCreate(input: $input) {
customer {
firstName
lastName
email
phone
acceptsMarketing
}
customerUserErrors {
field
message
code
}
}
}`,
"variables": {
"input": {
"firstName": "John",
"lastName": "Smith",
"email": "johnsmith@shopify.com",
"phone": "+15146669999",
"password": "5hopify",
"acceptsMarketing": true
}
},
},
});
use Shopify\Clients\Graphql;
$client = new ShopifyClientsStorefront("your-development-store.myshopify.com", $storefrontAccessToken);
$query = <<<QUERY
mutation customerCreate($input: CustomerCreateInput!) {
customerCreate(input: $input) {
customer {
firstName
lastName
email
phone
acceptsMarketing
}
customerUserErrors {
field
message
code
}
}
}
QUERY;
$variables = [
"input" => [
"firstName" => "John",
"lastName" => "Smith",
"email" => "johnsmith@shopify.com",
"phone" => "+15146669999",
"password" => "5hopify",
"acceptsMarketing" => true,
],
];
$response = $client->query(["query" => $query, "variables" => $variables]);
import {useShopQuery} from '@shopify/hydrogen';
const QUERY = gql`
mutation customerCreate($input: CustomerCreateInput!) {
customerCreate(input: $input) {
customer {
firstName
lastName
email
phone
acceptsMarketing
}
customerUserErrors {
field
message
code
}
}
}`;
const {data} = useShopQuery({
query: QUERY,
variables: {
input: {
firstName: "John",
lastName: "Smith",
email: "johnsmith@shopify.com",
phone: "+15146669999",
password: "5hopify",
acceptsMarketing: true
}
},
});