Overview
The Categories API provides comprehensive category management for organizing products in your marketplace. It supports both global categories (available to all stores) and store-specific categories, creating a flexible hierarchical structure. Location:convex/shared/categories.ts
Create Store Category
Creates a new store-specific category under the store’s primary category.Category name (1-100 characters)
Update Store Category
Updates a store-specific category name.Category ID to update
Updated category name
Delete Store Category
Deletes a store-specific category.Category ID to delete
Get Parent Categories
Retrieves all parent categories (categories with no parent).Get Categories by Parent ID
Retrieves all child categories under a parent category.Parent category ID
Get Global Categories
Retrieves all global categories (not store-specific).Get Store Categories
Retrieves all categories for a specific store.Store ID
Get Available Categories for Store
Retrieves all categories available to a store (global + store-specific).Store ID
Category Hierarchy
Categories follow a hierarchical structure:Error Handling
Category not found
Category not found
Status Code:
404Duplicate category name
Duplicate category name
Status Code:
400Cannot delete category with products
Cannot delete category with products
Status Code:
400Best Practices
Hierarchical Organization
Use the parent-child relationship to create logical product organization that customers can navigate easily.
Naming Convention
Use clear, descriptive names that customers will understand. Avoid technical jargon or internal codes.
Global vs Store Categories
Use global categories for broad classifications and store categories for specific subcategories unique to your store.
Category Maintenance
Regularly review and optimize your category structure based on customer behavior and product performance.
Categories are automatically indexed for search functionality. Changes to category names are reflected in search results immediately.
