WordPress at Your Fingertips
function is not described

WC_API_Products::register_routes() public WC 2.1

Register the routes for this class

GET /products GET /products/count GET /products/<id> GET /products/<id>/reviews

{} It's a method of the class: WC_API_Products{}

No Hooks.

Return

Array.

Usage

$WC_API_Products = new WC_API_Products();
$WC_API_Products->register_routes( $routes );
$routes(array) (required)
-

Changelog

Since 2.1 Introduced.

Code of WC_API_Products::register_routes() WC 5.7.1

public function register_routes( $routes ) {

	# GET /products
	$routes[ $this->base ] = array(
		array( array( $this, 'get_products' ),     WC_API_Server::READABLE ),
	);

	# GET /products/count
	$routes[ $this->base . '/count' ] = array(
		array( array( $this, 'get_products_count' ), WC_API_Server::READABLE ),
	);

	# GET /products/<id>
	$routes[ $this->base . '/(?P<id>\d+)' ] = array(
		array( array( $this, 'get_product' ),  WC_API_Server::READABLE ),
	);

	# GET /products/<id>/reviews
	$routes[ $this->base . '/(?P<id>\d+)/reviews' ] = array(
		array( array( $this, 'get_product_reviews' ), WC_API_Server::READABLE ),
	);

	return $routes;
}