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.

See below for some extra tips, such as changing text only if they paid with certain payment methods.

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.

Use the customer’s name in the message

You can get the customer’s name to use in a custom message, too. The following example gets the customer’s first name. The message to the customer says, “Thanks {name}, you’re amazing!” You can edit the message on line 8.

/**
 * Custom text on the receipt page.
 */
function isa_order_received_text( $text, $order ) {

	$first_name = $order->get_billing_first_name();

	return "Thanks $first_name, you're amazing!";
}
add_filter('woocommerce_thankyou_order_received_text', 'isa_order_received_text', 10, 2 );

You can also get the customer’s last name like this:

$last_name = $order->get_billing_last_name();

Other Tips

To change the “Order Received” page title, see this comment, below.

To make some text bold, see this comment, below.

To customize the text only if someone paid with PayPal, see this comment.

To customize the text only if someone paid with Direct Bank Transfer (BACS), see this comment.

See more:

We've 27 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. 🙂

    Helmar
  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. 🙂

    Alessandro Marengo
  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 🙂

    Amelia
    • 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.

      Isabel
  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

    miguel
  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?

    Klára
    • 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->get_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 );
      
      Isabel
      • 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

        Klára
      • December 7th, 2017 at 1:46 am

        Hi Isabel,

        Would this also work for “Bank Deposit”?

        I want to have my bank details and a description showing.

        I have placed what I think it should be in the code below.

        /**
         * Custom text on the receipt page only if payed with Bank Transfer (BACS)
         */
        function isa_order_received_text( $text, $order ) {
            if ( ! empty( $order ) ) {
                 
                // Get the payment method
         
                $payment_method = get_post_meta( $order->get_id(), '_payment_method', true );
                 
                // If Bank Deposit was used, show a custom message
         
                if ( 'bacs' == $payment_method ) {
         
                    $text = 'bank account details are BSB 000000 Account number 000000. Please use your order number in the payment description so we can attribute the deposit to your order.';
         
                }
         
            }
         
            return $text;
        }
        add_filter('woocommerce_thankyou_order_received_text', 'isa_order_received_text', 10, 2 );
        
        Liam
        • May 27th, 2019 at 11:35 pm

          Yes, that works to add custom text for Bank Transfer (BACS) payments. I just updated one part of this code, line 9: $order->id should now be $order->get_id().

          Isabel
  6. June 30th, 2017 at 7:00 am

    Hi Isabel,
    Do you know how I can make the text that I add or the original text black and bold. How could I edit that.
    Thank you,
    Maria

    Maria
    • May 27th, 2019 at 11:02 pm

      The original text is made bold on line 6. Your custom bold text goes on line 8:

      /**
       * Bold text on the receipt page.
       */
      function isa_order_received_text_bold( $text, $order ) {
      
          $original_text = '<strong>' . $text . '</strong>';
      
          $custom_text = '<strong>This is bold text.</strong>';
      
          return $original_text . $custom_text;
      }
      add_filter('woocommerce_thankyou_order_received_text', 'isa_order_received_text_bold', 10, 2 );
      
      Isabel
    • May 27th, 2019 at 11:17 pm

      Replace the Order Received page title with a new title: Replace “New Title” on line 5 with your own title.

      /**
       * Replace Order Received title with a new title
       */
      function isa_order_received_new_title( $title ) {
          return 'New Title';
      }
      add_filter( 'woocommerce_endpoint_order-received_title', 'isa_order_received_new_title', 99 );
      
      Isabel
  7. December 3rd, 2017 at 11:23 am

    Hey Isabel! Thanks for the code – surprised there aren’t more helpful resources out there!

    Do you know if it’s possible to change the title from: “Order received” to something that pulls the users first name in?

    Like “Thanks {name}, you’re amazing!”

    Cheers Isabel 🙂

    Stuart Edwards
    • 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.

      Isabel
  8. March 5th, 2019 at 9:03 pm

    This snippet worked very well for me. Still works in 2019. 🙂
    And then I used the solution to include it inside a plugin.
    Very simple and practical explanations, thank you very much for this solution.

    MM

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]