Change Related Products Text

In this tutorial I am going to talk with you about how to change related products text in WooCommerce. We are also going to cover upsells and cross-sells.

There are different ways of doing that, and some ways maybe not so good like the others.

First of all, just to let you know, the template of related products is located in single-product/related.php, the template of upsells is single-product/upsells.php, cross-sells – cart/cross-sells.php. So, I you remember how WooCommerce templates work, you know that you can easily replace those templates with your custom ones.

But, if you look into the templates code, you will see, that now WooCommerce has specific filter hooks that allow to change cross-sells, upsells and related products heading text. So, there is absolutely no need in template replacements.

These are the hooks:

Please try to insert the code below to your current theme functions.php file.

add_filter( 'woocommerce_product_related_products_heading', 'misha_change_related_products_heading' );

function misha_change_related_products_heading() {
	return 'You will definitely like';
}
change related products heading text in WooCommerce

Doing the same for cross-sells and upsells:

// change related products title (Previously: "Related products")
add_filter( 'woocommerce_product_related_products_heading', 'misha_change_related_products_heading' );
// change cross-sells heading text (Previously: "You may be interested in…")
add_filter( 'woocommerce_product_cross_sells_products_heading', 'misha_change_related_products_heading' );
// change upsell text (Previously: "You may also like…")
add_filter( 'woocommerce_product_upsells_products_heading', 'misha_change_related_products_heading' );

function misha_change_related_products_heading() {
	return 'You will definitely like';
}
Misha Rudrastyh

Misha Rudrastyh

Hey guys and welcome to my website. For more than 10 years I've been doing my best to share with you some superb WordPress guides and tips for free.

Need some developer help? Contact me

Follow me on Twitter