woocommerce_locate_template filter-hookWC 9.5.0

Filter to customize the path of a given WooCommerce template.

Note: the $default_path argument was added in WooCommerce 9.5.0.

Usage

add_filter( 'woocommerce_locate_template', 'wp_kama_woocommerce_locate_template_filter', 10, 3 );

/**
 * Function for `woocommerce_locate_template` filter-hook.
 * 
 * @param string $template      Full file path of the template.
 * @param string $template_name Template name.
 * @param string $template_path Default WooCommerce templates path.
 *
 * @return string
 */
function wp_kama_woocommerce_locate_template_filter( $template, $template_name, $template_path ){

	// filter...
	return $template;
}
$template(string)
Full file path of the template.
$template_name(string)
Template name.
$template_path(string)
Default WooCommerce templates path.

Changelog

Since 9.5.0 Introduced.
Since 9.5.0 $default_path argument added.

Where the hook is called

wc_locate_template()
woocommerce_locate_template
woocommerce/includes/wc-core-functions.php 436
return apply_filters( 'woocommerce_locate_template', $template, $template_name, $template_path, $default_path );

Where the hook is used in WooCommerce

Usage not found.