seems woocommerce doesn’t have any filters when registering their endpoints,
https://github.com/woothemes/woocommerce/blob/master/includes/class-wc-query.php#L84
so you need to add your new endpoint on init hooks, just like this
add_action( 'init', 'add_endpoint' );
function add_endpoint(){
add_rewrite_endpoint( 'license', EP_ROOT | EP_PAGES );
}
then you have to do some filtering on wc_get_template
to call your files when the request match your endpoint
add_filter( 'wc_get_template', 'custom_endpoint', 10, 5 );
function custom_endpoint($located, $template_name, $args, $template_path, $default_path){
if( $template_name == 'myaccount/my-account.php' ){
global $wp_query;
if(isset($wp_query->query['license'])){
$located = get_template_directory() . '/your-path-to-file.php';
}
}
return $located;
}
so when you visit my account page with endpoint license
,
let say http://yourdomain.com/my-account/license/
, that will display your custom code