WC_REST_Product_Attributes_V1_Controller::get_item()publicWC 1.0

Get a single attribute.

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

Хуков нет.

Возвращает

WP_REST_Request|WP_Error.

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

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

Код WC_REST_Product_Attributes_V1_Controller::get_item() WC 8.7.0

public function get_item( $request ) {
	$attribute = $this->get_attribute( (int) $request['id'] );

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

	$response = $this->prepare_item_for_response( $attribute, $request );

	return rest_ensure_response( $response );
}