mutation CustomerMerge {
customerMerge(customerOneId: "gid://shopify/Customer/544365967", customerTwoId: "gid://shopify/Customer/624407574", overrideFields: {customerIdOfFirstNameToKeep: "gid://shopify/Customer/544365967", customerIdOfLastNameToKeep: "gid://shopify/Customer/624407574"}) {
resultingCustomerId
job {
id
done
}
userErrors {
code
field
message
}
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2024-07/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "mutation CustomerMerge { customerMerge(customerOneId: \"gid://shopify/Customer/544365967\", customerTwoId: \"gid://shopify/Customer/624407574\", overrideFields: {customerIdOfFirstNameToKeep: \"gid://shopify/Customer/544365967\", customerIdOfLastNameToKeep: \"gid://shopify/Customer/624407574\"}) { resultingCustomerId job { id done } userErrors { code field message } } }",
"variables": {
"customerOneId": "gid://shopify/Customer/544365967",
"customerTwoId": "gid://shopify/Customer/624407574",
"overrideFields": {
"customerIdOfFirstNameToKeep": "gid://shopify/Customer/544365967",
"customerIdOfLastNameToKeep": "gid://shopify/Customer/544365967"
}
}
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation CustomerMerge {
customerMerge(customerOneId: "gid://shopify/Customer/544365967", customerTwoId: "gid://shopify/Customer/624407574", overrideFields: {customerIdOfFirstNameToKeep: "gid://shopify/Customer/544365967", customerIdOfLastNameToKeep: "gid://shopify/Customer/624407574"}) {
resultingCustomerId
job {
id
done
}
userErrors {
code
field
message
}
}
}`,
{
variables: {
"customerOneId": "gid://shopify/Customer/544365967",
"customerTwoId": "gid://shopify/Customer/624407574",
"overrideFields": {
"customerIdOfFirstNameToKeep": "gid://shopify/Customer/544365967",
"customerIdOfLastNameToKeep": "gid://shopify/Customer/544365967"
}
},
},
);
const data = await response.json();
session = ShopifyAPI::Auth::Session.new(
shop: "your-development-store.myshopify.com",
access_token: access_token
)
client = ShopifyAPI::Clients::Graphql::Admin.new(
session: session
)
query = <<~QUERY
mutation CustomerMerge {
customerMerge(customerOneId: "gid://shopify/Customer/544365967", customerTwoId: "gid://shopify/Customer/624407574", overrideFields: {customerIdOfFirstNameToKeep: "gid://shopify/Customer/544365967", customerIdOfLastNameToKeep: "gid://shopify/Customer/624407574"}) {
resultingCustomerId
job {
id
done
}
userErrors {
code
field
message
}
}
}
QUERY
variables = {
"customerOneId": "gid://shopify/Customer/544365967",
"customerTwoId": "gid://shopify/Customer/624407574",
"overrideFields": {
"customerIdOfFirstNameToKeep": "gid://shopify/Customer/544365967",
"customerIdOfLastNameToKeep": "gid://shopify/Customer/544365967"
}
}
response = client.query(query: query, variables: variables)
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"query": `mutation CustomerMerge {
customerMerge(customerOneId: "gid://shopify/Customer/544365967", customerTwoId: "gid://shopify/Customer/624407574", overrideFields: {customerIdOfFirstNameToKeep: "gid://shopify/Customer/544365967", customerIdOfLastNameToKeep: "gid://shopify/Customer/624407574"}) {
resultingCustomerId
job {
id
done
}
userErrors {
code
field
message
}
}
}`,
"variables": {
"customerOneId": "gid://shopify/Customer/544365967",
"customerTwoId": "gid://shopify/Customer/624407574",
"overrideFields": {
"customerIdOfFirstNameToKeep": "gid://shopify/Customer/544365967",
"customerIdOfLastNameToKeep": "gid://shopify/Customer/544365967"
}
},
},
});
use Shopify\Clients\Graphql;
$client = new Graphql("your-development-store.myshopify.com", $accessToken);
$query = <<<QUERY
mutation CustomerMerge {
customerMerge(customerOneId: "gid://shopify/Customer/544365967", customerTwoId: "gid://shopify/Customer/624407574", overrideFields: {customerIdOfFirstNameToKeep: "gid://shopify/Customer/544365967", customerIdOfLastNameToKeep: "gid://shopify/Customer/624407574"}) {
resultingCustomerId
job {
id
done
}
userErrors {
code
field
message
}
}
}
QUERY;
$variables = [
"customerOneId" => "gid://shopify/Customer/544365967",
"customerTwoId" => "gid://shopify/Customer/624407574",
"overrideFields" => [
"customerIdOfFirstNameToKeep" => "gid://shopify/Customer/544365967",
"customerIdOfLastNameToKeep" => "gid://shopify/Customer/544365967",
],
];
$response = $client->query(["query" => $query, "variables" => $variables]);