Anchor to customerReplaceTaxExemptionscustomer
customerReplaceTaxExemptions
mutation
Requires access scope.
Replace tax exemptions for a customer.
Anchor to Arguments
Arguments
- Anchor to customerIdcustomer•
Id ID!required The ID of the customer to update.
- Anchor to taxExemptionstax•
Exemptions [TaxExemption!]! required The list of tax exemptions that will replace the current exemptions for a customer. Can be an array or a comma-separated list. Example values:
,
.
Was this section helpful?
Anchor to CustomerReplaceTaxExemptionsPayload returnsCustomerReplaceTaxExemptionsPayload returns
- Anchor to customercustomer•
The updated customer.
- Anchor to userErrorsuser•
Errors [UserError!]! non-null The list of errors that occurred from executing the mutation.
Was this section helpful?
- Replace tax exemptions for a customer
- customerReplaceTaxExemptions reference
Examples
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation customerReplaceTaxExemptions($customerId: ID!, $taxExemptions: [TaxExemption!]!) {
customerReplaceTaxExemptions(customerId: $customerId, taxExemptions: $taxExemptions) {
userErrors {
field
message
}
customer {
id
taxExemptions
}
}
}`,
{
variables: {
"customerId": "gid://shopify/Customer/554122808",
"taxExemptions": [
"CA_MB_COMMERCIAL_FISHERY_EXEMPTION",
"CA_ON_PURCHASE_EXEMPTION"
]
},
},
);
const data = await response.json();
mutation customerReplaceTaxExemptions($customerId: ID!, $taxExemptions: [TaxExemption!]!) {
customerReplaceTaxExemptions(customerId: $customerId, taxExemptions: $taxExemptions) {
userErrors {
field
message
}
customer {
id
taxExemptions
}
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "mutation customerReplaceTaxExemptions($customerId: ID!, $taxExemptions: [TaxExemption!]!) { customerReplaceTaxExemptions(customerId: $customerId, taxExemptions: $taxExemptions) { userErrors { field message } customer { id taxExemptions } } }",
"variables": {
"customerId": "gid://shopify/Customer/554122808",
"taxExemptions": [
"CA_MB_COMMERCIAL_FISHERY_EXEMPTION",
"CA_ON_PURCHASE_EXEMPTION"
]
}
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation customerReplaceTaxExemptions($customerId: ID!, $taxExemptions: [TaxExemption!]!) {
customerReplaceTaxExemptions(customerId: $customerId, taxExemptions: $taxExemptions) {
userErrors {
field
message
}
customer {
id
taxExemptions
}
}
}`,
{
variables: {
"customerId": "gid://shopify/Customer/554122808",
"taxExemptions": [
"CA_MB_COMMERCIAL_FISHERY_EXEMPTION",
"CA_ON_PURCHASE_EXEMPTION"
]
},
},
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"query": `mutation customerReplaceTaxExemptions($customerId: ID!, $taxExemptions: [TaxExemption!]!) {
customerReplaceTaxExemptions(customerId: $customerId, taxExemptions: $taxExemptions) {
userErrors {
field
message
}
customer {
id
taxExemptions
}
}
}`,
"variables": {
"customerId": "gid://shopify/Customer/554122808",
"taxExemptions": [
"CA_MB_COMMERCIAL_FISHERY_EXEMPTION",
"CA_ON_PURCHASE_EXEMPTION"
]
},
},
});
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 customerReplaceTaxExemptions($customerId: ID!, $taxExemptions: [TaxExemption!]!) {
customerReplaceTaxExemptions(customerId: $customerId, taxExemptions: $taxExemptions) {
userErrors {
field
message
}
customer {
id
taxExemptions
}
}
}
QUERY
variables = {
"customerId": "gid://shopify/Customer/554122808",
"taxExemptions": ["CA_MB_COMMERCIAL_FISHERY_EXEMPTION", "CA_ON_PURCHASE_EXEMPTION"]
}
response = client.query(query: query, variables: variables)
Input variables
JSON{
"customerId": "gid://shopify/Customer/554122808",
"taxExemptions": [
"CA_MB_COMMERCIAL_FISHERY_EXEMPTION",
"CA_ON_PURCHASE_EXEMPTION"
]
}
Response
JSON{
"customerReplaceTaxExemptions": {
"userErrors": [],
"customer": {
"id": "gid://shopify/Customer/554122808",
"taxExemptions": [
"CA_MB_COMMERCIAL_FISHERY_EXEMPTION",
"CA_ON_PURCHASE_EXEMPTION"
]
}
}
}