The WooCommerce Product Search extension introduces a new REST API, which allows to use the Search Engine to build customized components and Apps which support holistic search and filtering. [1]
Endpoints
↑ Back to topThe new REST API includes the following endpoints:
- Shop :
GET /wp-json/wps/v1/shop
- Products :
GET /wp-json/wps/v1/products
- Terms :
GET /wp-json/wps/v1/terms
The REST API endpoints discussed here are part of the WooCommerce Product Search extension.
Shop
↑ Back to topProvide products, related terms and additional data for all products or those that match a specified set of search and filter constraints. Additional data includes stats about products on sale, stock status, price range data, ratings, stats on featured products and other relevant data.
HTTP Request : GET /wp-json/wps/v1/shop
The REST API – Shop documentation page provides a detailed description of the endpoint and its parameters.
Products
↑ Back to topProvide all products or those that match a specified set of search and filter constraints.
HTTP Request : GET /wp-json/wps/v1/products
The REST API – Products documentation page provides a detailed description of the endpoint and its parameters.
Terms
↑ Back to topProvide all taxonomy terms or those that match a specified set of search and filter constraints.
HTTP Request : GET /wp-json/wps/v1/terms
The REST API – Terms documentation page provides a detailed description of the endpoint and its parameters.
React & REST API Example Shop Implementation
↑ Back to topThe code of an example Shop Web App built with React which uses the REST API of the WooCommerce Product Search extension is freely available at the wps-react-rest-shop GitHub repository. The purpose of this code is to illustrate how one can use the search engine’s REST API to build components and Apps.
[1] The new REST API is available as of version 6.0.0 of the extension.
This section and its subsections provide information and examples that are intended to help developers build Apps and custom components with the REST API that the search engine provides. These sections are alive and enhanced as needed. If you are a developer and have questions on the use of the REST API for your components or App, you can reach out and Contact Support for the extension.