WC_REST_Product_Variations_V2_Controller::get_item_permissions_check()publicWC 1.0

Check if a given request has access to read an item.

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

Хуков нет.

Возвращает

WP_Error|true|false.

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

$WC_REST_Product_Variations_V2_Controller = new WC_REST_Product_Variations_V2_Controller();
$WC_REST_Product_Variations_V2_Controller->get_item_permissions_check( $request );
$request(WP_REST_Request) (обязательный)
Full details about the request.

Код WC_REST_Product_Variations_V2_Controller::get_item_permissions_check() WC 9.3.3

public function get_item_permissions_check( $request ) {
	if ( ! $this->check_variation_parent( (int) $request['id'], (int) $request['product_id'] ) ) {
		return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid ID.', 'woocommerce' ), array( 'status' => 404 ) );
	}

	return parent::get_item_permissions_check( $request );
}