woocommerce_rest_prepare_note filter-hookWC 3.9.0

Filter a note returned from the API.

Allows modification of the note data right before it is returned.

Usage

add_filter( 'woocommerce_rest_prepare_note', 'wp_kama_woocommerce_rest_prepare_note_filter', 10, 3 );

/**
 * Function for `woocommerce_rest_prepare_note` filter-hook.
 * 
 * @param WP_REST_Response $response The response object.
 * @param array            $data     The original note.
 * @param WP_REST_Request  $request  Request used to generate the response.
 *
 * @return WP_REST_Response
 */
function wp_kama_woocommerce_rest_prepare_note_filter( $response, $data, $request ){

	// filter...
	return $response;
}
$response(WP_REST_Response)
The response object.
$data(array)
The original note.
$request(WP_REST_Request)
Request used to generate the response.

Changelog

Since 3.9.0 Introduced.

Where the hook is called

Notes::prepare_item_for_response()
woocommerce_rest_prepare_note
woocommerce/src/Admin/API/Notes.php 609
return apply_filters( 'woocommerce_rest_prepare_note', $response, $data, $request );

Where the hook is used in WooCommerce

Usage not found.