1. Home
  2. Knowledge Base
  3. WooCommerce Product Filters
  4. Developer Documentation

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 IDs
  • parameters (JSON string, optional) - Filter parameters in JSON format
  • order_by (string, optional) - Sorting parameter
  • page (integer, optional) - Page number for pagination (default: 1)
  • requires_rendering (boolean, optional) - Whether to include rendered HTML output
  • query_args (JSON string, optional) - Additional WooCommerce query arguments
  • integrations (JSON string, optional) - Integration-specific parameters
  • reset (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&parameters=%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
}

Additional endpoints

The following endpoints are used internally by the plugin. They are not intended for public use, but are documented here for completeness.

Pricing (POST /pricing)

Returns the maximum price for a given taxonomy term.

URL: POST /wcf/v1/pricing

Parameters:

  • term_id – The term ID
  • taxonomy – The taxonomy name

Terms (GET /terms)

Retrieve the list of terms for a given taxonomy.

URL: GET /wcf/v1/terms

Parameters:

  • taxonomy – The taxonomy to retrieve terms from
  • search – Search string used to filter terms
  • include – Comma-separated list of term IDs to include

Related Articles

If searching the knowledge base hasn't answered your question, please contact support.