woocommerce_rest_prepare_(post_type)
Filter webhook object returned from the REST API.
Usage
add_filter( 'woocommerce_rest_prepare_(post_type)', 'wp_kama_woocommerce_rest_prepare_post_type_filter', 10, 3 );
/**
* Function for `woocommerce_rest_prepare_(post_type)` filter-hook.
*
* @param WP_REST_Response $response The response object.
* @param WC_Webhook $webhook Webhook object used to create response.
* @param WP_REST_Request $request Request object.
*
* @return WP_REST_Response
*/
function wp_kama_woocommerce_rest_prepare_post_type_filter( $response, $webhook, $request ){
// filter...
return $response;
}
- $response(WP_REST_Response)
- The response object.
- $webhook(WC_Webhook)
- Webhook object used to create response.
- $request(WP_REST_Request)
- Request object.
Where the hook is called
woocommerce_rest_prepare_(post_type)
woocommerce_rest_prepare_(post_type)
woocommerce_rest_prepare_(post_type)
woocommerce_rest_prepare_(post_type)
woocommerce_rest_prepare_(post_type)
woocommerce_rest_prepare_(post_type)
woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-webhooks-v1-controller.php 596
return apply_filters( "woocommerce_rest_prepare_{$this->post_type}", $response, $webhook, $request );
woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-coupons-v1-controller.php 221
return apply_filters( "woocommerce_rest_prepare_{$this->post_type}", $response, $post, $request );
woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php 637
return apply_filters( "woocommerce_rest_prepare_{$this->post_type}", $response, $post, $request );
woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-refunds-v1-controller.php 230
return apply_filters( "woocommerce_rest_prepare_{$this->post_type}", $response, $post, $request );
woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php 364
return apply_filters( "woocommerce_rest_prepare_{$this->post_type}", $response, $post, $request );
woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-webhooks-v2-controller.php 73
return apply_filters( "woocommerce_rest_prepare_{$this->post_type}", $response, $webhook, $request );
Where the hook is used in WooCommerce
woocommerce/includes/class-wc-brands.php 67
add_filter( 'woocommerce_rest_prepare_product', array( $this, 'rest_api_prepare_brands_to_product' ), 10, 2 ); // WC 2.6.x.
woocommerce/includes/class-wc-brands.php 68
add_filter( 'woocommerce_rest_prepare_product_object', array( $this, 'rest_api_prepare_brands_to_product' ), 10, 2 ); // WC 3.x.
woocommerce/src/Admin/API/Init.php 51
add_filter( 'woocommerce_rest_prepare_shop_order_object', array( __CLASS__, 'add_currency_symbol_to_order_response' ) );
woocommerce/src/Admin/API/Reports/PerformanceIndicators/Controller.php 138
add_filter( 'woocommerce_rest_prepare_report', $remove_self_link_from_prepared_internal_response );
woocommerce/src/Admin/API/Reports/PerformanceIndicators/Controller.php 140
remove_filter( 'woocommerce_rest_prepare_report', $remove_self_link_from_prepared_internal_response );
woocommerce/src/Admin/Features/PaymentGatewaySuggestions/PaymentGatewaysController.php 21
add_filter( 'woocommerce_rest_prepare_payment_gateway', array( __CLASS__, 'extend_response' ), 10, 3 );
woocommerce/src/Admin/Features/ProductBlockEditor/Init.php 82
add_filter( 'woocommerce_rest_prepare_product_object', array( $this, 'possibly_add_template_id' ), 10, 2 );
woocommerce/src/Admin/Features/ProductBlockEditor/Init.php 83
add_filter( 'woocommerce_rest_prepare_product_variation_object', array( $this, 'possibly_add_template_id' ), 10, 2 );