How to Change the “You may also like” WooCommerce Up-Sells Text

>How to Change the “You may also like” WooCommerce Up-Sells Text
  • rename

This post was last updated on November 4th, 2017!

Using WooCommerce’s Up-Sells feature is a good and profitable idea because you can recommend other products instead of the currently viewed one. It’s similar to using Related Posts at the bottom of your blog post.

In this way, you can bring to your customer’s attention other products that are more profitable, have a better quality, or are more expensive; it’s up to you.

The bad news is that this feature comes with the default text “You may also like…”, which will be positioned above the recommended products. Some of you may be bothered by this, like we were, because that text might not be such a good fit for your products or services. Therefore, you’ll want to change it, and I’ll tell you how!

How to change the WooCommerce Up-Sells text

I’ll point out five different ways to do this. If you know other techniques, please share it with us by dropping a comment.

The first two methods are not ideal, because the changes will be reversed with every update!

Method 1 – Changing the text in the up-sells.php file

1. Ok, what you need to do is to log into your hosting’s control panel (cPanel in this case) and find File Manager:

cpanel file manager

2. Now, under public_html, go to /wp-content/plugins/woocommerce/templates/single-product/up-sells.php:

up sells php file in woocommerce

3. Right-click on the upsells.php file and choose Edit or Code Edit to find the line quick.

4. After that, scroll down to line 39 (it may be a different line for you) and change the “You may also like” text to whatever you want.

change "you may also like..." woocommerce up-sells text

5. Click Save Changes and you’re done!

Method 2 – Changing the text in the woocommerce.pot file

That file might seems strange because of that .pot extension, but don’t worry, the editing process is the same.

1. Just like above, log into cPanel, go to File Manager, and under public_html go to /wp-content/plugins/woocommerce/i18n/languages/woocommerce.pot

woocommerce-pot-file

2. Now right-click it and select Edit or Code Edit. Since this is a large file, it will be easier to just press Ctrl+F (Command + F on Mac) on your keyboard, then enter “you may also like” in the search box, and click find.

change woocommerce "you may also like..." up-sells text

3. Change the text to whatever you like and click Save Changes.

The following three methods are ideal, because the changes won’t be reversed with every update, but they are a bit more advanced, and might also not work for everybody!

Method 3 – Copying and editing the up-sells.php file in your child theme

Create these folders in your child theme: /woocommerce/templates/single-product/ and add / paste the up-sells.php in the last folder, which is /single-product/. Then make the changes there.

So, eventually, the file should be found and edited here: /public_html/wp-content/themes/YourThemeName-child/woocommerce/templates/single-product/up-sells.php.

Note that this might not work on all themes!

Method 4 – Performing a function override in your child theme

Perform a function override and add it in your child theme’s function.php, but the same function probably won’t work for everyone, and even if it does, at some point it may stop working due to changes in the future WooCommerce updates, so you’ll have to make changes to your function as well. Therefore, if you’re not a developer, you’ll need to constantly seek help.

Christina recommended, in the comment section, to use the code found here:

<?php
/**
* Change text strings
*
* @link http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext
*/
function my_text_strings( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Related Products' :
$translated_text = __( 'Check out these related products', 'woocommerce' );
break;
}
return $translated_text;
}
add_filter( 'gettext', 'my_text_strings', 20, 3 );

This was recommended in 2013, and I don’t know for how many people it will still work now. One user said:

This was a great help to me last year and I changed a couple of strings really easily for me and my site. But yesterday I updated the site to WordPress 4.0 & WooCommerce 2.2.4 and now the strings are not working – the labels I previously had changed are back to normal!

Which proves what I said above – a function override might stop working at some point due to some string changes in the plugin’s future updates.

You could still try the code, if you wish, to see if it works, but make sure you back up your child theme’s function.php file, or perform a full website backup.

I couldn’t find a recent code, so if you wish to use this method, it would be best to ask your theme developers, or seek help on the WooCommerce forum. If you are a Woo customer, then, of course, you can benefit from their premium support.

Method 5 – Using a translation plugin

You could also use a plugin, like Loco Translate, as Vladislav pointed out in the comment section.

But I really don’t recommend using a plugin (the fewer plugins, the better) just for changing 4 words, unless your site is already in another language, and adding a translation plugin would be of help anyway.

That’s a wrap

Hope you found our guide useful! If you know another technique, please share it with us by leaving a comment!

Don’t forget to share the post with your friends!

By | 2018-03-08T20:49:13+00:00 May 12th, 2015|Coding, Plugins, Tips|27 Comments

27 Comments

  1. Brian August 12, 2015 at 7:28 PM - Reply

    Should these changes be visible immediately or does wordpress cache these somehow?

    • ThemeSkills January 22, 2016 at 9:20 PM - Reply

      Depends on the caching plugin/system. If the change doesn’t appear, then clear the cache (from your browser as well).

  2. vanesa January 9, 2016 at 9:11 PM - Reply

    THANK YOU!!! it helped me a lot! 🙂

    • ThemeSkills January 13, 2016 at 2:47 AM - Reply

      You’re most welcome! We’re very glad to hear that!

  3. Greg Maldewin January 19, 2016 at 11:27 PM - Reply

    Just what I was looking for. Thanks!

    • ThemeSkills January 22, 2016 at 9:18 PM - Reply

      We’re glad to hear that!

  4. Nathan February 3, 2016 at 2:19 PM - Reply

    Hello,
    I have Woocommerce but the basic language of my site is dutch.
    The translation of \”You may also like\” is not OK, so I want to change this.
    Any idea where I can find this text that needs to be replaced?

    Thanks!
    Nathan

    • ThemeSkills February 3, 2016 at 7:45 PM - Reply

      Hello! I assume that the text you are referring to is “Gerelateerde producten”, no? You tried the 2 solutions pointed out in the blog post, but didn’t find that piece of code? It should be there usually…

  5. Pete February 27, 2016 at 2:14 PM - Reply

    You can also use the gettext filter described in this post: but for this particular case you need to replace the 3 dots with the html hellip syntax – in long hand that is ampersand hellip semi-colon ( if I write the actual syntax in this comment I suspect it might get interpreted as 3 dots)

    so refer to the post and add something like this:
    case ‘You may also like ampersand hellip semi-colon’ : /*change that to the proper hellip syntax */
    $translated_text = __( ‘Additional Product Options’, ‘woocommerce’ );
    break;

  6. Shica March 4, 2016 at 2:34 PM - Reply

    I follow step by step instructions (php) and it has not change the text. Is it possible Im missing on something? or some themes are just not flexible? thank you!

    • ThemeSkills March 7, 2016 at 10:49 PM - Reply

      Hello! Did you clear your browser (hit Ctrl+F5 on Windows; Cmd+Shift+R on Mac, I believe) and site cache?

  7. Emma March 18, 2016 at 9:47 PM - Reply

    I just did method one and now my product images won’t load in Woocommerce … please help … I’m freaking out!

  8. Duke the blogger October 3, 2016 at 5:40 PM - Reply

    What if i update my plugin later? Do i lose the changes?

    • ThemeSkills October 6, 2016 at 5:33 PM - Reply

      Unfortunately, yes.

      • Name : November 29, 2016 at 3:56 AM - Reply

        Is there a way to edit this file in my child theme so that I do not lose these changes as I update plugins?

        • Martin Jarvis September 29, 2017 at 2:53 PM - Reply

          Yes, you should be able to copy the up-sells.php file into your child theme and edit it there.

  9. jordan December 8, 2016 at 3:43 PM - Reply

    I there ! sorry for my bad englsih,

    I have just a problem for translate Up-sell title in wordpress in product page for complete my product package in different language like french and english.
    when i changed the title for exemple \”complete your package\” the title stay the same for other language to … that my problem

    have you a idea please ? 🙂 thank\’s

  10. Christina Arasmo April 26, 2017 at 1:08 AM - Reply

    Use get text instead. Then it won’t change again when Woocommerce updates.

    https://www.speakinginbytes.com/2013/10/gettext-filter-wordpress/

    function yourprefix_change_text_strings_woocommerce( $translated_text, $text, $domain ) {
    switch ( $translated_text ) {
    case ‘You may also like…’ :
    $translated_text = __( ‘You may also enjoy …’, ‘cherish’ );
    break;
    case ‘Related products’ :
    $translated_text = __( ‘Lovely Related Items’, ‘cherish’ );
    break;
    }
    return $translated_text;
    }
    add_filter( ‘gettext’, ‘yourprefix_change_text_strings_woocommerce’, 20, 3 );

  11. Vladislav Vladimirov June 2, 2017 at 5:58 PM - Reply

    You should *never* make changes to the core PHP files. 1. the changes will get overwritten on next update, and 2. you will break the links to other translations which use the string in the PHP as an ID for the translated string. Thus, if you change “Some phrase” in the PHP file to “Some other phrase”, and it was translated in German, for example, the original “Some phrase” will not exist in PHP, and the German translation will not appear, since it will be a translation for “Some phrase”, and not for “Some other phrase”.

    Changing the POT file is almost the same – it will get overwritten.

    One good way to make it is by adding a translation of the original string and translate it into another string. Basically, translate English to… English 🙂 This can easily be done by adding a plugin like “Loco Translate” which will allow you to edit translations from the admin of WordPress. Then you add a new language translation for “WooCommerce” – “English (US)” (if this is the basic language of your site). Then you just find the string to change, and add it as a translation. That’s it 🙂

  12. Jessica November 2, 2017 at 4:06 AM - Reply

    Hello,

    Please advise how to find the file name: woocommerce/templates/single-product/up-sells.php in word press?

    It seems I can only get upto woocommerce/templates/single-product.php

    I would like to edit the “you may like” text for upsells

    Any suggestions?

    • ThemeSkills November 4, 2017 at 8:53 AM - Reply

      Hello!

      You need to access your files via your web host’s control panel, like I pointed out in the article, or you need to use a 3rd party software, like FileZilla – https://codex.wordpress.org/Using_FileZilla

      Once there, find the file, edit it, and replace the “You may also like…” text with whatever you wish, like you see in the above images.

  13. DJDeals.com January 24, 2018 at 3:29 AM - Reply

    Vladislav Vladimirov is correct, on all counts. We used his advice to change my woocommerce cross sell text “You May Also Be Interested In…” in our cart, and the translation plugin worked flawlessly.

  14. Johnny Ringo March 20, 2018 at 11:13 AM - Reply

    How do you move the “you may be interested in” products above the cart, rather than side by side or below it?

    Side note: Also, how do you limit the number of products displayed?

  15. Riyaz April 15, 2018 at 5:20 PM - Reply

    Thanks, man….I was trying to change text with Javascript. You saved me.

Leave A Comment

Want to follow us before leaving?

close-link
Get our latest posts once a week, right in your inbox
Subscribe
close-image