/**
* Adds custom path to WooCommerce template locate.
*
* Usage, e.g.: `wc_get_template_html( 'my-template.php' )`
*
* @see https://wpcodebook.com/woocommerce-locate-template-custom-path/
* @see https://github.com/woocommerce/woocommerce/blob/8.2.2/plugins/woocommerce/includes/wc-core-functions.php#L420
*/
add_filter( 'woocommerce_locate_template', function ( $template, $template_name, $template_path ) {
// TODO: Set your template path and name
$_path = WP_PLUGIN_DIR . '/my-plugin/templates/';
$_name = 'my-template.php';
return ( $_name === $template_name && ! file_exists( $template ) ? $_path . $_name : $template );
}, 10, 3 );