Skip to main content

updateCategory

Requires permission categories:category:update.

Updates a category, including moving it under another parent, which also updates the level and path of its subcategories. A code already used by another active category is refused, and so is a parent that would create a loop. Requires permission to update 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 UpdateCategory($input: UpdateCategoryInput!) {
updateCategory(input: $input) {
id
code
name
createdAt
childrenCount
deletedAt
children {
id
code
name
createdAt
childrenCount
deletedAt
}
}
}

Variables:

{
"input": {
"id": "id"
}
}

Response:

{
"data": {
"updateCategory": {
"id": "id",
"code": "string",
"name": "string",
"createdAt": "2025-01-15T00:00:00Z",
"childrenCount": 0,
"deletedAt": "2025-01-15T00:00:00Z",
"children": [
{
"id": "id",
"code": "string",
"name": "string",
"createdAt": "2025-01-15T00:00:00Z",
"childrenCount": 0,
"deletedAt": "2025-01-15T00:00:00Z"
}
]
}
}
}
updateCategory(
input: UpdateCategoryInput!
): Category!

Arguments​

updateCategory.input ● UpdateCategoryInput! non-null input​

The ID of the category and the fields to change.

Type​

Category object​

A node in the category tree. A root category is an ordinary category.