WordPress at Your Fingertips
function is not described

WC_REST_CRUD_Controller::prepare_object_for_response() protected WC 3.0.0

Prepares the object for the REST response.

{} It's a method of the class: WC_REST_CRUD_Controller{}

No Hooks.

Return

WP_Error|WP_REST_Response. Response object on success, or WP_Error object on failure.

Usage

// protected - for code of main (parent) or child class
$result = $this->prepare_object_for_response( $object, $request );
$object(WC_Data) (required)
Object data.
$request(WP_REST_Request) (required)
Request object.

Changelog

Since 3.0.0 Introduced.

Code of WC_REST_CRUD_Controller::prepare_object_for_response() WC 5.9.0

protected function prepare_object_for_response( $object, $request ) {
	// translators: %s: Class method name.
	return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass.", 'woocommerce' ), __METHOD__ ), array( 'status' => 405 ) );
}