Allow plugins to filter located template location before failing

This commit is contained in:
Lee Willis 2018-10-31 09:48:29 +00:00
parent 59d60debb7
commit b826a80e93
1 changed files with 3 additions and 3 deletions

View File

@ -194,15 +194,15 @@ function wc_get_template( $template_name, $args = array(), $template_path = '',
$located = wc_locate_template( $template_name, $template_path, $default_path );
// Allow 3rd party plugin filter template file from their plugin.
$located = apply_filters( 'wc_get_template', $located, $template_name, $args, $template_path, $default_path );
if ( ! file_exists( $located ) ) {
/* translators: %s template */
wc_doing_it_wrong( __FUNCTION__, sprintf( __( '%s does not exist.', 'woocommerce' ), '<code>' . $located . '</code>' ), '2.1' );
return;
}
// Allow 3rd party plugin filter template file from their plugin.
$located = apply_filters( 'wc_get_template', $located, $template_name, $args, $template_path, $default_path );
do_action( 'woocommerce_before_template_part', $template_name, $template_path, $located, $args );
include $located;