Changing the “Related Products” Text in WooCommerce

To change the “Related Products” text in WooCommerce to any other text, simply copy the following code into the “functions.php” of your WordPress child theme’s theme editor.

Route:

Appearance / Theme Editor / functions.php

After the line < ? php

Add:
// Change the text "Related products" in WooCommerce
add_filter('gettext', 'change_rp_text', 10, 3);
add_filter('ngettext', 'change_rp_text', 10, 3);
function change_rp_text($translated, $text, $domain)
{ if ($text === 'Related products' && $domain === 'woocommerce') {
$translated = esc_html__('THE NEW TEXT I WANT TO PUT', $domain);}
return $translated;}

 

Replaces ‘THE NEW TEXT I WANT TO PUT ‘for the text you want to appear in that section. Voilà!

Leave a Reply

Your email address will not be published. Required fields are marked *