Dwindi Ramadhana
8f61e39272
feat: Add backend API endpoints for taxonomy CRUD operations
Problem: Frontend taxonomy pages (Categories, Tags, Attributes) were getting 404 errors
when trying to create/update/delete because the backend endpoints didn't exist.
Solution: Added complete CRUD API endpoints to ProductsController
Routes Added:
1. Categories:
- POST /products/categories (create)
- PUT /products/categories/{id} (update)
- DELETE /products/categories/{id} (delete)
2. Tags:
- POST /products/tags (create)
- PUT /products/tags/{id} (update)
- DELETE /products/tags/{id} (delete)
3. Attributes:
- POST /products/attributes (create)
- PUT /products/attributes/{id} (update)
- DELETE /products/attributes/{id} (delete)
Implementation:
- All endpoints use admin permission check
- Proper sanitization of inputs
- WordPress taxonomy functions (wp_insert_term, wp_update_term, wp_delete_term)
- WooCommerce attribute functions (wc_create_attribute, wc_update_attribute, wc_delete_attribute)
- Error handling with WP_Error checks
- Consistent response format with success/data/message
Methods Added:
- create_category() / update_category() / delete_category()
- create_tag() / update_tag() / delete_tag()
- create_attribute() / update_attribute() / delete_attribute()
Files Modified:
- includes/Api/ProductsController.php (added 9 CRUD methods + route registrations)
Result:
✅ Categories can now be created/edited/deleted from admin SPA
✅ Tags can now be created/edited/deleted from admin SPA
✅ Attributes can now be created/edited/deleted from admin SPA
✅ No more 404 errors on taxonomy operations
2025-12-27 00:16:15 +07:00
..
2025-12-27 00:12:44 +07:00
2025-12-27 00:16:15 +07:00
2025-12-26 22:58:21 +07:00
2025-12-26 21:29:27 +07:00
2025-11-19 18:35:34 +07:00
2025-12-26 21:57:56 +07:00
2025-12-26 23:43:40 +07:00
2025-11-10 23:18:56 +07:00