woocommerce_hydration_dispatch_request filter-hookWC 8.9.0

Similar to WP core's rest_dispatch_request this allows plugin to override hydrating the request. Allows backward compatibility with the rest_dispatch_request by providing the same arguments.

Usage

add_filter( 'woocommerce_hydration_dispatch_request', 'wp_kama_woocommerce_hydration_dispatch_request_filter', 10, 4 );

/**
 * Function for `woocommerce_hydration_dispatch_request` filter-hook.
 * 
 * @param mixed           $hydration_result Result of the hydration. If not null, this will be used as the response.
 * @param WP_REST_Request $request          Request used to generate the response.
 * @param string          $path             Request path matched for the request..
 * @param array           $handler          Route handler used for the request.
 *
 * @return mixed
 */
function wp_kama_woocommerce_hydration_dispatch_request_filter( $hydration_result, $request, $path, $handler ){

	// filter...
	return $hydration_result;
}
$hydration_result(mixed)
Result of the hydration. If not null, this will be used as the response.
$request(WP_REST_Request)
Request used to generate the response.
$path(string)
Request path matched for the request..
$handler(array)
Route handler used for the request.

Changelog

Since 8.9.0 Introduced.

Where the hook is called

Hydration::get_response_from_controller()
woocommerce_hydration_dispatch_request
woocommerce/src/Blocks/Domain/Services/Hydration.php 150
$hydration_result = apply_filters( 'woocommerce_hydration_dispatch_request', null, $request, $path, $handler );

Where the hook is used in WooCommerce

Usage not found.