How does the plugin work with the REST API?
The WordPress REST API provides a way to interact with your website by JSON objects. We ensure our plugins work with REST wherever possible.
This article contains details about how WooCommerce Product Filters works with the REST API.
Base URL
All API endpoints are prefixed with the namespace wcf/v1
:
https://your-site.com/wp-json/wcf/v1/
Authentication
Public Endpoints
Some endpoints are publicly accessible and don't require authentication:
/search
- Product search and filtering
Admin Endpoints
Admin endpoints require WordPress administrator privileges:
/indexer-status
- Check indexing status/start-batch-index
- Start product indexing
For admin endpoints, you can authenticate using:
- WordPress nonce in the
x-wp-nonce
header - WordPress REST API authentication (JWT, application passwords, etc.)
Endpoints
1. Product Search (GET /search
)
The main endpoint for searching and filtering products.
URL: GET /wcf/v1/search
Parameters:
groups
(string, required) - Comma-separated list of filter group IDsparameters
(JSON string, optional) - Filter parameters in JSON formatorder_by
(string, optional) - Sorting parameterpage
(integer, optional) - Page number for pagination (default: 1)requires_rendering
(boolean, optional) - Whether to include rendered HTML outputquery_args
(JSON string, optional) - Additional WooCommerce query argumentsintegrations
(JSON string, optional) - Integration-specific parametersreset
(boolean, optional) - Whether this is a reset request
Example Request:
curl -X GET "https://your-site.com/wp-json/wcf/v1/search?groups=1,2¶meters=%7B%22product_cat%22%3A%5B%2210%22%5D%7D&page=1"
Example Response:
{
"success": true,
"results": {
"products": [123, 456, 789],
"total": 150,
"total_pages": 5,
"current_page": 1,
"filters": {
"product_cat": {
"10": 45,
"11": 23
}
}
}
}
With Rendering:
curl -X GET "https://your-site.com/wp-json/wcf/v1/search?groups=1&requires_rendering=true"
Response with HTML:
{
"success": true,
"results": {
"products": [123, 456, 789],
"total": 150
},
"output": "<div class='products-grid'>...</div>"
}
2. Indexer Status (GET /indexer-status
)
Check the status of the product indexing process.
URL: GET /wcf/v1/indexer-status
Authentication: Admin required
Example Request:
curl -X GET "https://your-site.com/wp-json/wcf/v1/indexer-status" \
-H "x-wp-nonce: your-nonce-here"
Example Response:
{
"success": true,
"running": false,
"message": "Regenerating the index in the background. Product filtering and sorting may not be accurate until this finishes. It will take a few minutes and this notice will disappear when complete."
}
4. Start Batch Index (POST /start-batch-index
)
Start the batch indexing process for all products.
URL: POST /wcf/v1/start-batch-index
Authentication: Admin required
Example Request:
curl -X POST "https://your-site.com/wp-json/wcf/v1/start-batch-index" \
-H "x-wp-nonce: your-nonce-here" \
-H "Content-Type: application/json"
Example Response:
{
"success": true
}