WC_REST_Fulfillments_V4_Controller::register_routespublicWC 4.0.0

Register the routes for fulfillments.

Method of the class: WC_REST_Fulfillments_V4_Controller{}

No Hooks.

Returns

null. Nothing (null).

Usage

$WC_REST_Fulfillments_V4_Controller = new WC_REST_Fulfillments_V4_Controller();
$WC_REST_Fulfillments_V4_Controller->register_routes();

Changelog

Since 4.0.0 Introduced.

WC_REST_Fulfillments_V4_Controller::register_routes() code WC 10.3.6

public function register_routes() {
	// Register the route for getting and setting order fulfillments.
	register_rest_route(
		$this->namespace,
		$this->rest_base,
		array(
			array(
				'methods'             => \WP_REST_Server::READABLE,
				'callback'            => array( $this, 'get_fulfillments' ),
				'permission_callback' => array( $this, 'check_permission_for_fulfillments' ),
				'args'                => $this->get_args_for_get_fulfillments(),
				'schema'              => $this->get_schema_for_get_fulfillments(),
			),
			array(
				'methods'             => \WP_REST_Server::CREATABLE,
				'callback'            => array( $this, 'create_fulfillment' ),
				'permission_callback' => array( $this, 'check_permission_for_fulfillments' ),
				'args'                => $this->get_args_for_create_fulfillment(),
				'schema'              => $this->get_schema_for_create_fulfillment(),
			),
		),
	);

	// Register the route for getting a specific fulfillment.
	register_rest_route(
		$this->namespace,
		$this->rest_base . '/(?P<fulfillment_id>[\d]+)',
		array(
			array(
				'methods'             => \WP_REST_Server::READABLE,
				'callback'            => array( $this, 'get_fulfillment' ),
				'permission_callback' => array( $this, 'check_permission_for_fulfillments' ),
				'args'                => $this->get_args_for_get_fulfillment(),
				'schema'              => $this->get_schema_for_get_fulfillment(),
			),
			array(
				'methods'             => \WP_REST_Server::EDITABLE,
				'callback'            => array( $this, 'update_fulfillment' ),
				'permission_callback' => array( $this, 'check_permission_for_fulfillments' ),
				'args'                => $this->get_args_for_update_fulfillment(),
				'schema'              => $this->get_schema_for_update_fulfillment(),
			),
			array(
				'methods'             => \WP_REST_Server::DELETABLE,
				'callback'            => array( $this, 'delete_fulfillment' ),
				'permission_callback' => array( $this, 'check_permission_for_fulfillments' ),
				'args'                => $this->get_args_for_delete_fulfillment(),
				'schema'              => $this->get_schema_for_delete_fulfillment(),
			),
		),
	);
}