Итак, фильтр не заработал, но я нашел обходной путь. Вместо применения фильтра к пути, в класс электронной почты я добавил базу шаблонов, которая проверяет, есть ли файл в теме, если нет, то использует файл плагина. Это позволяет переопределить шаблон плагина через тему.
В вызове конструкции пользовательского электронного письма WooCommerce я добавил:
$this->template_base = $this->get_template_path();
, который вызывает эту функцию:
public function get_template_path() {
// are we looking for html or plain?
$template = ($this->get_option( 'email_type' ) == 'html') ? $this->template_html : $this->template_plain;
// path to theme woocommerce file overrides
$theme_path = get_stylesheet_directory() . '/woocommerce/';
//plugin path
$plugin_path = plugin_dir_path( dirname( __FILE__ ) ) . 'templates/';
// if we have a theme file let's use it, otherwise revert to plugin file
$path = (file_exists($theme_path . $template) ) ? $theme_path : $plugin_path;
return $path;
}
Теперь это работает. Это специфично для путей к шаблонам электронной почты, но это все, что мне нужно.