fix: Resolve route conflict - OrdersController was hijacking /products endpoint
ROOT CAUSE FOUND! OrdersController registered /products BEFORE ProductsController: - OrdersController::init() called first (line 25 in Routes.php) - ProductsController::register_routes() called later (line 95) - WordPress uses FIRST matching route - OrdersController /products was winning! This explains EVERYTHING: ✅ Route registered: SUCCESS ✅ Callback is_callable: YES ✅ Permissions: ALLOWED ✅ Request goes to /woonoow/v1/products ❌ But OrdersController::products() was handling it! Solution: 1. Changed OrdersController route from /products to /products/search 2. Updated ProductsApi.search() to use /products/search 3. Now /products is free for ProductsController! Result: - /products → ProductsController::get_products() (full product list) - /products/search → OrdersController::products() (lightweight search for orders) This will finally make ProductsController work!
This commit is contained in:
@@ -96,7 +96,7 @@ export const OrdersApi = {
|
||||
};
|
||||
|
||||
export const ProductsApi = {
|
||||
search: (search: string, limit = 10) => api.get('/products', { search, limit }),
|
||||
search: (search: string, limit = 10) => api.get('/products/search', { search, limit }),
|
||||
};
|
||||
|
||||
export const CustomersApi = {
|
||||
|
||||
Reference in New Issue
Block a user