WordPress at Your Fingertips
function is not described

WC_REST_Tax_Classes_V1_Controller::prepare_item_for_response() public WC 1.0

Prepare a single tax class output for response.

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

Hooks from the method


WP_REST_Response. $response Response data.


$WC_REST_Tax_Classes_V1_Controller = new WC_REST_Tax_Classes_V1_Controller();
$WC_REST_Tax_Classes_V1_Controller->prepare_item_for_response( $tax_class, $request );
$tax_class(array) (required)
Tax class data.
$request(WP_REST_Request) (required)
Full details about the request.

Code of WC_REST_Tax_Classes_V1_Controller::prepare_item_for_response() WC 5.9.0

public function prepare_item_for_response( $tax_class, $request ) {
	$data = $tax_class;

	$context = ! empty( $request['context'] ) ? $request['context'] : 'view';
	$data    = $this->add_additional_fields_to_object( $data, $request );
	$data    = $this->filter_response_by_context( $data, $context );

	// Wrap the data in a response object.
	$response = rest_ensure_response( $data );

	$response->add_links( $this->prepare_links() );

	 * Filter tax object returned from the REST API.
	 * @param WP_REST_Response $response  The response object.
	 * @param stdClass         $tax_class Tax object used to create response.
	 * @param WP_REST_Request  $request   Request object.
	return apply_filters( 'woocommerce_rest_prepare_tax', $response, (object) $tax_class, $request );