wc_get_template_part( ‘content’, ‘product’ ) | Where is this file located?

As mentioned in the comments, wc_get_template_part() tries to locate and load the requested template file.
These template files could be ether in the /woocommerce/ sub-directory of a child-theme, or defined in another third party plugin (with the help of woocommerce_locate_template filter hook). If none of these exists, WC loads the default template file from /plugins/woocommerce/templates/ directory.

Updated Question

WoocCommerce uses WordPress Plugin API to load template content. That’s why there are plenty of do_action() functions in the template files. You can ( and probably should) use these action filters to manipulate the content. Overriding the whole template file should be the last choice (duo to best practices).
In this case content-product.php file contains this line:

do_action( 'woocommerce_before_shop_loop_item_title' );

Default content for all templates is defined in /plugins/woocommerce/includes/wc-template-hooks.php and for the title we have this:

add_action( 'woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_title', 10 );

In this case, woocommerce_template_loop_product_title function adds the HTML markups and the content to the title section and is located in this file: /plugins/woocommerce/includes/wc-template-functions.php

function woocommerce_template_loop_product_title() {
    echo '<h2 class="' . esc_attr( apply_filters( 'woocommerce_product_loop_title_classes', 'woocommerce-loop-product__title' ) ) . '">' . get_the_title() . '</h2>';
}

You can ether use woocommerce_shop_loop_item_title to add extra HTML markups in the title part, or remove the default content and add your own:

remove_action( 'woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_title', 10 );
add_action( 'woocommerce_shop_loop_item_title', 'tst_your_function', 10 );

function tst_your_function() {
    echo '<h3 class="' . esc_attr( apply_filters( 'woocommerce_product_loop_title_classes', 'woocommerce-loop-product__title' ) ) . '"><strong>' . get_the_title() . '</string></h3>';
}

Leave a Comment