I use this code in in my plugin file. The content from the original orders.php file is gone that means the filter does work but my own file does not showing up.
I added this code in the plugin main file
<?php
define("PLUGIN_DIR_PATH", plugin_dir_path(__FILE__));
?>
and this code below in the plugin functions file.
The functions.php is located in pluginfolder/required/functions.php
<?php
add_filter( 'wc_get_template', 'q343_get_template', 10, 5 );
function q343_get_template( $located, $template_name, $args, $template_path, $default_path ) {
if ( 'myaccount/orders.php' == $template_name ) {
$located = PLUGIN_DIR_PATH . 'required/templates/orders.php';
}
return $located;
}
?>
The template that I will load is located in pluginfolder/required/templates/orders.php