WordPress at Your Fingertips
function is not described


OnboardingProfile::prepare_item_for_response() public WC 1.0

Prepare the data object for response.

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


WP_REST_Response. $response Response data.


$OnboardingProfile = new OnboardingProfile();
$OnboardingProfile->prepare_item_for_response( $item, $request );
$item(object) (required)
Data object.
$request(WP_REST_Request) (required)
Request object.

Code of OnboardingProfile::prepare_item_for_response() WC 6.1.0

public function prepare_item_for_response( $item, $request ) {
	$data     = $this->add_additional_fields_to_object( $item, $request );
	$data     = $this->filter_response_by_context( $data, 'view' );
	$response = rest_ensure_response( $data );

	 * Filter the list returned from the API.
	 * @param WP_REST_Response $response The response object.
	 * @param array            $item     The original item.
	 * @param WP_REST_Request  $request  Request used to generate the response.
	return apply_filters( 'woocommerce_rest_onboarding_prepare_profile', $response, $item, $request );