Skip to main content

bulkDeleteCategories

Requires permission categories:category:delete.

Deletes several categories at once, up to 500. Each category follows the same rule as deleting it on its own: one that still has subcategories or active products is skipped and reported, and so is an ID that is not in your organization. Subcategories are deleted before their parents, so selecting a parent with all its empty subcategories deletes the whole branch. Requires permission to delete categories.

Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.

Example:

mutation BulkDeleteCategories($ids: [ID!]!) {
bulkDeleteCategories(ids: $ids) {
deleted
deletedIds
requested
failures {
id
code
name
reason
}
}
}

Variables:

{
"ids": [
"id"
]
}

Response:

{
"data": {
"bulkDeleteCategories": {
"deleted": 0,
"deletedIds": [
"id"
],
"requested": 0,
"failures": [
{
"id": "id",
"code": "string",
"name": "string",
"reason": "string"
}
]
}
}
}
bulkDeleteCategories(
ids: [ID!]!
): CatalogBulkDeleteResult!

Arguments​

bulkDeleteCategories.ids ● [ID!]! non-null scalar​

The IDs of the categories to delete, at most 500. Duplicates count once.

Type​

CatalogBulkDeleteResult object​

The outcome of a bulk delete of brands or categories: what was deleted and what was refused.