This post was last updated on 5/30/2019
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 to other products that are more profitable, have 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, as I 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 by dropping a comment.
Also, you might want to read this guide to find out how to access your WordPress website’s files.
The first two methods are not ideal because the changes will be reversed with every update! Also, I recommend creating a file or site backup first!
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:
2. Now, under public_html, go to:
/wp-content/plugins/woocommerce/templates/single-product/up-sells.php
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.
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
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.
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.
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 from method 1 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
Add the below code in your child theme’s functions.php
file. Add it at the very bottom or right before the ?>
ending tag (if any).
If you don’t have a child theme, use the Code Snippets plugin to add the code there.
// Change "You may also like..." text in WooCommerce
add_filter('gettext', 'change_ymal');
function change_ymal($translated)
{
$translated = str_ireplace('You may also like', 'Add your new text here', $translated);
return $translated;
}
Change the Add your new text here line between the single quotes with your own text.
Method 5 – Using a translation plugin
You could also use a translation plugin, such as Loco Translate, as Vladislav pointed out in the comment section.
But I really don’t recommend using a plugin only 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 the tutorial useful, and you managed to change the “You may also like…” up-sells text in WooCommerce!
If you have any questions or thoughts, drop a comment or send a message via contact or Facebook page.
You can also hit the follow button on Twitter and subscribe to the YouTube channel.
Don’t forget to share the post to help out others!
Should these changes be visible immediately or does wordpress cache these somehow?
Depends on the caching plugin/system. If the change doesn’t appear, then clear the cache (from your browser as well).
THANK YOU!!! it helped me a lot! :)
You’re most welcome! We’re very glad to hear that!
Just what I was looking for. Thanks!
We’re glad to hear that!
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
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…
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;
*this post: http://speakinginbytes.com/2013/10/gettext-filter-wordpress/#comment-159903
Thanks for pointing that out!
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!
Hello! Did you clear your browser (hit Ctrl+F5 on Windows; Cmd+Shift+R on Mac, I believe) and site cache?
I just did method one and now my product images won’t load in Woocommerce … please help … I’m freaking out!
What if i update my plugin later? Do i lose the changes?
Unfortunately, yes.
Is there a way to edit this file in my child theme so that I do not lose these changes as I update plugins?
Yes, you should be able to copy the up-sells.php file into your child theme and edit it there.
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
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 );
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 :)
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?
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.
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.
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?
Hello!
To limit the number of products displayed, add this code and adjust the number – https://docs.woocommerce.com/document/change-number-of-products-displayed-per-page/. But first, make sure to check your theme’s settings for a feature like this. A lot of themes have one. I also recommend having a child theme in place, and back up the file or the entire website before adding the code.
Your first request requires quite a bit of custom coding, I think, which we cannot provide. You could ask for help in these places:
1. https://wordpress.org/support/plugin/woocommerce, but I doubt you’ll succeed, especially if it requires too much custom coding;
2. https://wordpress.stackexchange.com/;
3. https://woocommerce.com/customizations/ – Paid;
4. https://www.fiverr.com/categories/programming-tech/wordpress-services – Paid;
5. Why not, kindly ask your theme developers for help, if you have a premium theme. If it’s not too much hassle for them, they might help you out.
Thanks, man….I was trying to change text with Javascript. You saved me.
Translation for the Woocommerce platform may seem to be a complex process so it’s good to have a basic understanding of it. Thinking that human translators will be the best choice for translating product listings is misguided in many ecommerce contexts. In fact, machine translation combined with AI and adapted to ecommerce requirements can make a world of difference in terms of conversion rates. For more comprehensive info on translation for Woocommerce and the role of Artificial Intelligence in ecommerce translation, feel free to check out the guide “The comprehensive guide to translation for Woocommerce”:
https://www.webinterpret.com/us/blog/ecommerce-translation-woocommerce/
Great post! Thanks. Moving and changing the cross-sells.php file in DIVI theme didn;t work for my so I used Loco Translate: https://wordpress.org/plugins/loco-translate/
Worked perfectly :)
Great! I’m happy it worked! Thanks for letting me and the other readers know!
I tried to do the first method but now I get a text above the header that says the following: add_filter(‘gettext’, ‘change_relatedproducts_text’, 10, 3); function change_relatedproducts_text($new_text, $related_text, $source) { if ($related_text === ‘Related products’ && $source === ‘woocommerce’) { $new_text = esc_html__(‘We Think You Might Also Like’, $ source); } return $new_text;