woocommerce_blocks_hook_compatibility_additional_data filter-hookWC 9.5.0

When extensions implement their equivalent blocks of the template hook functions, they can use this filter to register their old hooked data here, so in the blockified template, the old hooked functions can be removed in favor of the new blocks while keeping the old hooked functions working in classic templates.

Accepts an array of hooked data. The array should be in the following format: [ [

hook => <hook-name>,
function => <function-name>,
priority => <priority>,

], ... ] Where:

  • hook-name is the name of the hook that have the functions hooked to.
  • function-name is the hooked function name.
  • priority is the priority of the hooked function.

Usage

add_filter( 'woocommerce_blocks_hook_compatibility_additional_data', 'wp_kama_woocommerce_blocks_hook_compatibility_additional_data_filter', 10, 2 );

/**
 * Function for `woocommerce_blocks_hook_compatibility_additional_data` filter-hook.
 * 
 * @param array  $data       Additional hooked data. Default to empty
 * @param string $class_name Class name within which the hook is called. Either ArchiveProductTemplatesCompatibility or SingleProductTemplateCompatibility.
 *
 * @return array
 */
function wp_kama_woocommerce_blocks_hook_compatibility_additional_data_filter( $data, $class_name ){

	// filter...
	return $data;
}
$data(array)
Additional hooked data. Default to empty
$class_name(string)
Class name within which the hook is called. Either ArchiveProductTemplatesCompatibility or SingleProductTemplateCompatibility.

Changelog

Since 9.5.0 Introduced.

Where the hook is called

AbstractTemplateCompatibility::remove_default_hooks()
woocommerce_blocks_hook_compatibility_additional_data
woocommerce/src/Blocks/Templates/AbstractTemplateCompatibility.php 168
$additional_hook_data = apply_filters( 'woocommerce_blocks_hook_compatibility_additional_data', array(), $class_name );

Where the hook is used in WooCommerce

Usage not found.