Anchor to tagsAddtags
tagsAdd
mutation
Add tags to an order, a draft order, a customer, a product, or an online store article.
Anchor to Arguments
Arguments
- •ID!required
The ID of a resource to add tags to.
- Anchor to tagstags•[String!]!required
A list of tags to add to the resource. Can be an array of strings or a single string composed of a comma-separated list of values. Example values:
["tag1", "tag2", "tag3"]
,"tag1, tag2, tag3"
.
Was this section helpful?
Anchor to TagsAddPayload returnsTagsAddPayload returns
- Anchor to nodenode•
The object that was updated.
- Anchor to userErrorsuser•
Errors [UserError!]! non-null The list of errors that occurred from executing the mutation.
Was this section helpful?
Examples
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation addTags($id: ID!, $tags: [String!]!) {
tagsAdd(id: $id, tags: $tags) {
node {
id
}
userErrors {
message
}
}
}`,
{
variables: {
"id": "gid://shopify/Customer/544365967",
"tags": "one, two, three"
},
},
);
const data = await response.json();
mutation addTags($id: ID!, $tags: [String!]!) {
tagsAdd(id: $id, tags: $tags) {
node {
id
}
userErrors {
message
}
}
}
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 addTags($id: ID!, $tags: [String!]!) { tagsAdd(id: $id, tags: $tags) { node { id } userErrors { message } } }",
"variables": {
"id": "gid://shopify/Customer/544365967",
"tags": "one, two, three"
}
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation addTags($id: ID!, $tags: [String!]!) {
tagsAdd(id: $id, tags: $tags) {
node {
id
}
userErrors {
message
}
}
}`,
{
variables: {
"id": "gid://shopify/Customer/544365967",
"tags": "one, two, three"
},
},
);
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 addTags($id: ID!, $tags: [String!]!) {
tagsAdd(id: $id, tags: $tags) {
node {
id
}
userErrors {
message
}
}
}
QUERY
variables = {
"id": "gid://shopify/Customer/544365967",
"tags": "one, two, three"
}
response = client.query(query: query, variables: variables)
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"query": `mutation addTags($id: ID!, $tags: [String!]!) {
tagsAdd(id: $id, tags: $tags) {
node {
id
}
userErrors {
message
}
}
}`,
"variables": {
"id": "gid://shopify/Customer/544365967",
"tags": "one, two, three"
},
},
});
Input variables
JSON{
"id": "gid://shopify/Customer/544365967",
"tags": "one, two, three"
}
Response
JSON{
"tagsAdd": {
"node": {
"id": "gid://shopify/Customer/544365967"
},
"userErrors": []
}
}