Products

Product Management Overview

The Products module stores every SKU in the products table and exposes them through REST endpoints that both the React admin and storefront shortcodes consume.

How the products screen works

  • React admin list: The list view (see screenshot) calls ProductController::index() with search, status, and category filters. Actions include Edit, Delete, and opening the category manager.
  • Storefront parity: [kitbix_commerce_products] reuses ProductController::publicIndex(), so pagination, stock badges, and category filters match what admins see.
  • Categories modal: Clicking “Manage Categories” opens the tree powered by CategoryController. Any change updates the category_product pivot instantly.
  • Product editor: The single edit form writes via ProductController::update(), handling media galleries, pricing, and category assignment in one payload.

Workflow from admin to storefront

  1. Create or edit a product inside Kitbix Commerce → Products.
  2. Assign categories so storefront filters populate (UI posts categories array, controller filters nonexistent IDs).
  3. Save. ProductController persists the record and emits kitbix_commerce_product_saved for addons.
  4. Reload the storefront product grid; it calls the public endpoint and reflects the new card, pricing, stock badge, and permalink.
  5. Open the product detail page rendered by public/templates/product-single.php to verify gallery images and descriptions.
Screenshot: Products list inside wp-admin showing search, filters, “Add Product”, and inline edit/delete actions.

Use captures from your own environment to replace placeholders before publishing docs.

Tips & best practices

Tip: Use the “Refresh Data” button in the admin list if you update products via REST; it re-queries ProductController::index() without a full reload.
Tip: Keep product slugs human-readable. Storefront permalinks are generated from the slug using kitbix_commerce_product_permalink().

Common mistakes

  • Deleting products that are still referenced by orders—there is no cascade cleanup.
  • Forgetting to re-sync categories after importing products; the pivot table stays empty unless Category::syncProductCategories() runs.
Reminder: Product data is independent of WordPress posts. Back up the products, categories, and category_product tables before bulk edits.