WooCommerce: Hide “Thanks for shopping with us” etc. @ Emails

WooCommerce emails come with the following hard-coded (argh!) greetings: ‘Thanks for shopping with us.‘, ‘Thanks for reading.‘, ‘We look forward to seeing you soon.‘, ‘We look forward to fulfilling your order soon.‘, ‘Thanks!‘, ‘We hope to see you again soon.‘ based on the specific email.

While having these greetings in the WooCommerce customer email footer may look nice and friendly, it is unlike WooCommerce to present them without the possibility to “filter” them out (i.e. removing them if you don’t want them).

So, a workaround is necessary. And it’s pretty simple: we just tell WooCommerce to “translate” those strings into empty strings, so that they don’t show. Enjoy!

WooCommerce Customer Completed Email: hiding the “Thanks for shopping with us.” greeting

Snippet (PHP): Hide “Thanks for shopping with us.” and other greetings @ WooCommerce Customer Order Emails


/**
 * @snippet       Hide Greetings @ WooCommerce Emails
 * @how-to        Watch tutorial @ https://businessbloomer.com/?p=19055
 * @sourcecode    https://businessbloomer.com/?p=111192
 * @author        Rodolfo Melogli
 * @compatible    WooCommerce 3.5.4
 * @donate $9     https://businessbloomer.com/bloomer-armada/
 */ 

add_filter( 'gettext', 'bbloomer_translate_woocommerce_strings_emails', 999 );
 
function bbloomer_translate_woocommerce_strings_emails( $translated ) {
   // Get strings and translate them into empty string >>> ''
   $translated = str_ireplace( 'Thanks for shopping with us.', '', $translated );
   $translated = str_ireplace( 'We hope to see you again soon.', '', $translated );
   return $translated;
}

Where to add this code?

You can place PHP snippets at the bottom of your child theme functions.php file (before "?>" if you have it). CSS, on the other hand, goes in your child theme style.css file. Make sure you know what you are doing when editing such delicate files - if you need more guidance, please take a look at my free WooCommerce Customization video tutorial.

Does this snippet still work?

Please let me know in the comments if everything worked as expected. I would be happy to revise the snippet if you report otherwise (please provide screenshots). I have tested this code with Storefront theme, the WooCommerce version listed above and a WordPress-friendly hosting on PHP 7.

If you think this code saved you time & money, please join other Business Bloomer supporters and avail of 365 days of WooCommerce benefits. Thank you in advance :)

Need Help with WooCommerce?

Check out these free videos, tutorials and tips!

  • how-to-edit-woocommerce-with-php-snippets
  • woocommerce-hooks-add_action-list-visual
  • woocommerce-customize-single-product-page-PHP
  • woocommerce-customize-shop-page-PHP
  • woocommerce-advanced-customization
  • how-to-edit-woocommerce-cart
  • woocommerce-customize-checkout-page-PHP
  • woocommerce-email-customization
  • woocommerce-conditional-logic

Rodolfo Melogli

Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as a WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza.

2 thoughts on “WooCommerce: Hide “Thanks for shopping with us” etc. @ Emails

  1. Hi Rodolfo,

    Thanks for this. Couple of queries.

    1. I read somewhere that gettext is very resource intensive. Please share some thoughts on this. Will the above code make everything slow?
    2. This code seems to look for the phrase everywhere. Is there something that can be added to restrict this translation to specific emails?

    Thanks

    1. It’s fine if not used too much ๐Ÿ™‚ Also, you can pass the “textdomain” to the gettext function and e.g. only look for “woocommerce” strings. Hope this helps

Questions? Feedback? Support? Leave your Comment Now!
_____

If you are writing code, please wrap it between: [php]code_here[/php]. Failure to complying with this (as well as going off topic) will result in comment deletion. You should expect a reply in about a week - this is a popular blog but I need to get paid work done first. Please consider joining #BloomerArmada to ask me 1-to-1 WooCommerce questions. Thank you :)

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.