By default WooCommerce uses the words “related product”, when showing the related products below a single product view.
I wished to change these words, supplementing the preferred text of my client.
Rather than editing the plugin directly which may subsequently be over-ridden on an update, I was looking to make the change either by the hooks and an entry in the file functions.php or by editing a copy of one of the template files.
Choosing to make the change by way of the template file, I copied the file related.php from
to the child theme WooCommerce template directory
Within the file look for:
<div class=”related products”><h2><?php _e(‘Related Products’, ‘woocommerce’); ?></h2>
Change the text between the <h2></h2> tags to your preferred text.
Periodically WooCommerce makes changes to the template files. An alert is shown on your WordPress admin if attention is required to your copied files. I have found it to be a simple task to review the differences between the new file and my website copy. If appropriate take a copy of the modified master template and re-implement your website specific changes.
Alternatively look to make the change in the language translation files
Looking in the translation file for WooCommerce, found at:
#: templates/single-product/rating.php:42 msgid "%s customer review" msgid_plural "%s customer reviews" msgstr "" msgstr "" #: templates/single-product/related.php:51 msgid "Related Products" msgstr "" #: templates/single-product/review-meta.php:28 msgid "Your comment is awaiting approval" msgstr ""
To make your change put your updated text in the msgstr, between the empty speech marks. for example:
#: templates/single-product/related.php:51 msgid "Related Products" msgstr "Similar products"
This can be readily changed. However, as before with making such changes, the next update of the plugin is likely to over-write your changes.
My view is that it’s easier to make changes to the templates file, and compare this with a future update version. The template file will also accept annotation, allowing the changes to be highlighted and described.
Scanning down through and amending a language file with a list of language relationships will be harder. Also easy to forget the purpose of the change in the language file.