From b826a80e936db8470ccf47b365d5ecb3b29afc78 Mon Sep 17 00:00:00 2001 From: Lee Willis Date: Wed, 31 Oct 2018 09:48:29 +0000 Subject: [PATCH] Allow plugins to filter located template location before failing --- includes/wc-core-functions.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/wc-core-functions.php b/includes/wc-core-functions.php index f9ab2265457..449b7a2c6c4 100644 --- a/includes/wc-core-functions.php +++ b/includes/wc-core-functions.php @@ -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' ), '' . $located . '' ), '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;