wc_get_template

wc_get_template

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter
See hook in action

See hook in core

Displaying hooks found in version: woocommerce.9.8.1

apply_filters('wc_get_template') is found 2 times:

  • /includes/rest-api/Controllers/Version2/class-wc-rest-system-status-v2-controller.php line 1333
    1329
    1330
    1331
    1332
    1333
    1334
    1335
    1336
    1337
    1338
    1339
    $scan_files[] = 'taxonomy-product_cat.php';
    $scan_files[] = 'taxonomy-product_tag.php';
     
    foreach ( $scan_files as $file ) {
        $located = apply_filters( 'wc_get_template', $file, $file, array(), WC()->template_path(), WC()->plugin_path() . '/templates/' );
     
        if ( file_exists( $located ) ) {
            $theme_file = $located;
        } elseif ( file_exists( get_stylesheet_directory() . '/' . $file ) ) {
            $theme_file = get_stylesheet_directory() . '/' . $file;
        } elseif ( file_exists( get_stylesheet_directory() . '/' . WC()->template_path() . $file ) ) {
  • /includes/wc-core-functions.php line 314
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
        $template = wc_untokenize_path( $template, wc_get_path_define_tokens() );
    }
     
    // Allow 3rd party plugin filter template file from their plugin.
    $filter_template = apply_filters( 'wc_get_template', $template, $template_name, $args, $template_path, $default_path );
     
    if ( $filter_template !== $template ) {
        if ( ! file_exists( $filter_template ) ) {
            /* translators: %s template */
            wc_doing_it_wrong( __FUNCTION__, sprintf( __( '%s does not exist.', 'woocommerce' ), '<code>' . $filter_template . '</code>' ), '2.1' );
            return;

See this hook used in plugins: