The woocommerce_locate_template function is deprecated in favor of wc_locate_template: you can read the code here .
However, if you are looking for a filter , it is still woocommerce_locate_template and takes three arguments:
- $ template , which is the result of the wp locate_template core function
- $ template_name , this is just the file name
- $ template_path is the woocommerce path for templates
So you can check if $ template_name is what you want to intercept and change the path if true, e.g.
function intercept_wc_template($template, $template_name, $template_path) {
if ($template_name == 'that_template.php') {
$template = 'the/path/of/your/plugin/template.php';
}
return $template;
}
add_filter('woocommerce_locate_template', 'intercept_wc_template', 20, 3);
, :)
, !
- 1: : P -
- 2: ! -