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

Метод класса: WC_API_Orders{}

Хуков нет.

Возвращает

Массив.

Использование

$WC_API_Orders = new WC_API_Orders();
$WC_API_Orders->register_routes( $routes );
$routes(массив) (обязательный)
-

Список изменений

С версии 2.1 Введена.

Код WC_API_Orders::register_routes() WC 7.7.2

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;
}