Web & Software Developer

Customize The Text on WooCommerce Thank You Page – Order Received Page

Easily Customize the text on the WooCommerce “Thank You” page without any custom template files. The “Thank You” page is also known as the “Order Received” page, or the Receipt page. This lets you do it easily. This can go in your functions file or in a plugin.

The default text is, “Thank you. Your order has been received.” The example below adds just 1 sentence, “A receipt has been sent to you via email.” You can replace that with your own text below.

/**
 * Custom text on the receipt page.
 */
function isa_order_received_text( $text, $order ) {
	$new = $text . ' A receipt has been sent to you via email.';
	return $new;
}
add_filter('woocommerce_thankyou_order_received_text', 'isa_order_received_text', 10, 2 );

The example above shows both the original text and the new text. So, it will say:

“Thank you. Your order has been received. A receipt has been sent to you via email.”

If you want to remove the original text (“Thank you. Your order has been received.”), and only use your own new text, then use this:

/**
 * Custom text on the receipt page.
 */
function isa_order_received_text( $text, $order ) {
	return 'A receipt has been sent to you via email.';
}
add_filter('woocommerce_thankyou_order_received_text', 'isa_order_received_text', 10, 2 );

You can change A receipt has been sent to you via email. to your own custom text.

By

We've 18 Responses

  1. August 26th, 2015 at 4:18 pm

    After tons of searching for custom order confirmation text per product, your post, dear Isabel, has been the most helpful. Now if only I could get an extra text field on the backend, where I can save the text, AND possibly one that accepts parameters (login, email download, hash or similar), I’d be in heaven. 🙂

    avatar
  2. November 20th, 2016 at 2:40 pm

    Thanks for sharing!
    I’ve been searching for ages since a solution like this! After a few more tweaks I got finally a custom message for every customer in my thankyou page. 🙂

    avatar
  3. January 29th, 2017 at 5:33 pm

    Hello, I was wondering when you say put the code on the function file, is this the right path?

    wp-content/themes/nameofmytheme/functions.php.

    Sorry to ask such a basic question but I am a true beginner to WordPress and coding, lol!

    Anyway, I would like to add a third line after ‘A receipt has been sent to you via email’ saying: ‘Please make sure to fill in this registration form before attending the studio’ and put a link to the word ‘registration form’ that takes my customers to a page with a form/waiver.

    I would greatly appreciate your help please.

    Thanks 🙂

    avatar
    • January 29th, 2017 at 6:35 pm

      Hi. See this for where to add the code.

      To add your sentence, insert the following code after line 5 (push line 6 down). But first, replace the “http://YOURPAGE.COM” in the code below with the web address of your registration page.

      $new .= ' Please make sure to fill in this <a href="http://YOURPAGE.COM">registration form</a> before attending the studio.';
      

      I hope this helps.

      avatar
  4. March 4th, 2017 at 8:15 pm

    Hello,

    I try the code but the custom text is showing first.

    How to delete custom text and show only the new text?

    Thank you,

    Regards

    avatar
  5. April 2nd, 2017 at 9:59 am

    Hi Lisa,
    Thank you for this really helpful snippet. I was searching for a solution to write a custom message on “Thank You” page only for those people, who had payed with PayPal. Is it possible to get the payment method of the order and if it’s it’s PayPal, write the new text?

    avatar
    • April 3rd, 2017 at 8:22 pm

      Sure, use the following code. Add your custom message on line 15. That will only be shown if a customer paid with PayPal. All other customers will get the default message.

      /**
       * Custom text on the receipt page only if payed with PayPal
       */
      function isa_order_received_text( $text, $order ) {
      	if ( ! empty( $order ) ) {
      		
      		// Get the payment method
      
      		$payment_method = get_post_meta( $order->id, '_payment_method', true );
      		
      		// If PayPal was used, show a custom message
      
      		if ( 'paypal' == $payment_method ) {
      
      			$text = 'A receipt has been sent to you via email.';
      
      		}
      
          }
      
          return $text;
      }
      add_filter('woocommerce_thankyou_order_received_text', 'isa_order_received_text', 10, 2 );
      
      avatar
      • April 3rd, 2017 at 9:45 pm

        Hi Isabel,
        First of all, I apologize to You for “Lisa” in my previous comment. It was probably caused by “isa_” in your code and my inattention…
        Your new code is working great, so Thank You very much for it. 🙂
        Klára

        avatar
    • November 27th, 2018 at 9:44 am

      To allow the text to be translated, in the first code block, change line 5 to this:

      $new = $text . ' ' . __( 'A receipt has been sent to you via email.', 'your_text_domain' );

      If you’re using the 2nd code block, change line 5 to this:

      return __( 'A receipt has been sent to you via email.', 'your_text_domain' );

      In both cases, you must replace your_text_domain to your own text domain for translations. You may replace the message inside the single quotes to your desired text.

      avatar

Questions and Comments are Welcome

Your email address will not be published. All comments will be moderated.

Please wrap code in "code" bracket tags like this:

[code]

YOUR CODE HERE 

[/code]