Use the deleteProductCategory mutation to delete a category by its id. The category must not have subcategories or associated products — both will block deletion.
mutation deleteProductCategory {
deleteProductCategory(id: "113d331a-6884-40ab-b87b-cb1a962be711") {
id
}
}Response
{
"data": {
"deleteProductCategory": {
"id": "113d331a-6884-40ab-b87b-cb1a962be711"
}
}
}Errors
Category not found
{
"errors": [
{
"message": "Category with id '113d331a-...' not found",
"extensions": { "code": "CATEGORY_NOT_FOUND" }
}
]
}Category has subcategories
{
"errors": [
{
"message": "Category 'Electronics' has 3 subcategories and cannot be deleted",
"extensions": { "code": "CATEGORY_HAS_SUBCATEGORIES" }
}
]
}Category has products
{
"errors": [
{
"message": "Category 'Laptops' has 12 products and cannot be deleted",
"extensions": { "code": "CATEGORY_HAS_PRODUCTS" }
}
]
}Authentication
This API uses API Key authentication. See Using the Connect API for instructions on how to get and use your API key.
