title: Wordpress custom endpoint template doesn’t load
body: <p>I’m trying to add custom template <code>account-details.php</code> to my new endpoint in my-account area.</p>
  
  <p>I have added the new account-details endpoint first:</p>
  
  <pre><code>add_action( 'init', 'co_add_my_account_endpoint' );
  
  function co_add_my_account_endpoint() {
      add_rewrite_endpoint( 'account-details', EP_ROOT | EP_PAGES );
  }
  </code></pre>
  
  <p>and here I’m adding the custom template:</p>
  
  <pre><code>add_filter( 'wc_get_template', 'co_custom_endpoint', 10, 5 );
  /**
  * Add account details custom template
  *
  * @param $located
  * @param $template_name
  * @param $args
  * @param $template_path
  * @param $default_path
  * @since 2.0
  * @return string $located
  */
  function co_custom_endpoint($located, $template_name, $args, $template_path, $default_path) {
      global $wp;
  
      if( 'myaccount/my-account.php' == $template_name ) {
          $located = wc_locate_template( 'myaccount/account-details.php', $template_path, JGTB_PATH . 'templates/' );
      }
  
      return $located;
  }
  </code></pre>
  
  <p>At the end I flush rewrite rules manually, but my template is still not loading on frontend. Anyone can see what am I doing wrong?
  I have found other posts on stack-overflow regarding this, but if I replicate exactly the same it doesn’t work for me either.. any ideas? </p>
  
  <p>Any help is very appreciated!</p>