Remove tags from an order, a draft order, a customer, a product, or an online store article.


Anchor to id
id
required

The ID of the resource to remove tags from.

A list of tags to remove from the resource in the form of an array of strings. Example value: ["tag1", "tag2", "tag3"].


Was this section helpful?

The object that was updated.

The list of errors that occurred from executing the mutation.


Was this section helpful?

Examples

Hide code
Copy
mutation removeTags($id: ID!, $tags: [String!]!) {
  tagsRemove(id: $id, tags: $tags) {
    node {
      id
    }
    userErrors {
      message
    }
  }
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2024-01/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "mutation removeTags($id: ID!, $tags: [String!]!) { tagsRemove(id: $id, tags: $tags) { node { id } userErrors { message } } }",
 "variables": {
    "id": "gid://shopify/Customer/544365967",
    "tags": [
      "Bob"
    ]
  }
}'
const { admin } = await authenticate.admin(request);

const response = await admin.graphql(
  `#graphql
  mutation removeTags($id: ID!, $tags: [String!]!) {
    tagsRemove(id: $id, tags: $tags) {
      node {
        id
      }
      userErrors {
        message
      }
    }
  }`,
  {
    variables: {
      "id": "gid://shopify/Customer/544365967",
      "tags": [
        "Bob"
      ]
    },
  },
);

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 removeTags($id: ID!, $tags: [String!]!) {
    tagsRemove(id: $id, tags: $tags) {
      node {
        id
      }
      userErrors {
        message
      }
    }
  }
QUERY

variables = {
  "id": "gid://shopify/Customer/544365967",
  "tags": ["Bob"]
}

response = client.query(query: query, variables: variables)
const client = new shopify.clients.Graphql({session});
const data = await client.query({
  data: {
    "query": `mutation removeTags($id: ID!, $tags: [String!]!) {
      tagsRemove(id: $id, tags: $tags) {
        node {
          id
        }
        userErrors {
          message
        }
      }
    }`,
    "variables": {
      "id": "gid://shopify/Customer/544365967",
      "tags": [
        "Bob"
      ]
    },
  },
});
use Shopify\Clients\Graphql;

$client = new Graphql("your-development-store.myshopify.com", $accessToken);
$query = <<<QUERY
  mutation removeTags($id: ID!, $tags: [String!]!) {
    tagsRemove(id: $id, tags: $tags) {
      node {
        id
      }
      userErrors {
        message
      }
    }
  }
QUERY;

$variables = [
  "id" => "gid://shopify/Customer/544365967",
  "tags" => ["Bob"],
];

$response = $client->query(["query" => $query, "variables" => $variables]);
Hide code
Input variables
Copy
{
  "id": "gid://shopify/Customer/544365967",
  "tags": [
    "Bob"
  ]
}
Hide code
Response
JSON
{
  "tagsRemove": {
    "node": {
      "id": "gid://shopify/Customer/544365967"
    },
    "userErrors": []
  }
}