WC_API_Orders::register_routes()publicWC 2.1

Register the routes for this class

GET /orders GET /orders/count GET|PUT /orders/<id> GET /orders/<id>/notes

Method of the class: WC_API_Orders{}

No Hooks.

Return

Array.

Usage

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

Changelog

Since 2.1 Introduced.

WC_API_Orders::register_routes() code WC 7.7.0

public function register_routes( $routes ) {

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

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

	# GET|PUT /orders/<id>
	$routes[ $this->base . '/(?P<id>\d+)' ] = array(
		array( array( $this, 'get_order' ),  WC_API_Server::READABLE ),
		array( array( $this, 'edit_order' ), WC_API_Server::EDITABLE | WC_API_Server::ACCEPT_DATA ),
	);

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

	return $routes;
}