deleteCategory( )


Deletes a category.

Authentication

This function requires elevated permissions and runs only on the backend and on dashboard pages.

Permissions
Manage Events - all permissions
Learn more about app permissions.
Method Declaration
Copy
function deleteCategory(categoryId: string): Promise<void>;
Method Parameters
categoryIdstringRequired

ID of category to be deleted.

JavaScript
import { categories } from "wix-events.v2"; import { webMethod, Permissions } from "wix-web-module"; import { elevate } from "wix-auth"; const elevatedDeleteCategory = elevate(categories.deleteCategory); // Sample categoryId value: "5fa9929d-6782-4927-9b8c-304ca9ca6e93" export const myDeleteCategoryFunction = webMethod( Permissions.Anyone, async (categoryId) => { try { const deletedCategory = await elevatedDeleteCategory(categoryId); console.log("Category is deleted"); return deletedCategory; } catch (error) { console.error(error); // Handle the error } }, ); /* Promise resolves to void */
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?