Automattic\WooCommerce\Internal\Orders

OrderActionsRestController::check_permissionsprivateWC 1.0

Permission check for REST API endpoint.

Method of the class: OrderActionsRestController{}

No Hooks.

Returns

true|false|WP_Error. True if the current user has the capability, otherwise a WP_Error object.

Usage

// private - for code of main (parent) class only
$result = $this->check_permissions( $request );
$request(WP_REST_Request) (required)
The request for which the permission is checked.

OrderActionsRestController::check_permissions() code WC 9.9.3

private function check_permissions( WP_REST_Request $request ) {
	$order_id = $this->validate_order_id( $request );

	if ( is_wp_error( $order_id ) ) {
		return $order_id;
	}

	return $this->check_permission( $request, 'read_shop_order', $order_id );
}