woocommerce_blocks_pre_get_routes_from_namespace filter-hookWC 8.7.0

Gives opportunity to return routes without invoking the compute intensive REST API.

Usage

add_filter( 'woocommerce_blocks_pre_get_routes_from_namespace', 'wp_kama_woocommerce_blocks_pre_get_routes_from_namespace_filter', 10, 3 );

/**
 * Function for `woocommerce_blocks_pre_get_routes_from_namespace` filter-hook.
 * 
 * @param array  $routes    Array of routes.
 * @param string $namespace Namespace for routes.
 * @param string $context   Context, can be edit or view.
 *
 * @return array
 */
function wp_kama_woocommerce_blocks_pre_get_routes_from_namespace_filter( $routes, $namespace, $context ){

	// filter...
	return $routes;
}
$routes(array)
Array of routes.
$namespace(string)
Namespace for routes.
$context(string)
Context, can be edit or view.

Changelog

Since 8.7.0 Introduced.

Where the hook is called

AbstractBlock::get_routes_from_namespace()
woocommerce_blocks_pre_get_routes_from_namespace
woocommerce/src/Blocks/BlockTypes/AbstractBlock.php 474-479
$routes = apply_filters(
	'woocommerce_blocks_pre_get_routes_from_namespace',
	array(),
	$namespace,
	'view'
);

Where the hook is used in WooCommerce

Usage not found.