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.
Eric
August 26th, 2015 at 3:57 pm
Really useful snippet – thank you for sharing!
Helmar
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. 🙂
Jonas
April 21st, 2016 at 7:54 am
Thank you Isabel! This code was very useful to me! 🙂
Clear and precise! I like your snippets.
Cheers, Jonas
Monica Ramos
November 12th, 2016 at 1:37 pm
Awesome! Super simple and it worked on the first try. Thanks =)
Alessandro Marengo
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. 🙂
Amelia
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 🙂
Isabel
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.
I hope this helps.
Amelia
January 29th, 2017 at 6:51 pm
Hi Isabel, thank you so much! 🙂
miguel
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
Isabel
March 8th, 2017 at 10:37 pm
Hi, I just added a second example to explain that more clearly. Use the second example to show only your own new text. Hope that helps.
Klára
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?
Isabel
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.
Klára
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
Liam
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.
Isabel
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()
.Nauris
June 4th, 2020 at 4:29 am
This is no longer working since it seems that Paypal is inserting it’s own message into this hook.
Maria
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
Isabel
May 27th, 2019 at 11:02 pm
The original text is made bold on line 6. Your custom bold text goes on line 8:
Haz
September 12th, 2017 at 4:16 am
Thanks for the codes. Really helpful.
May i ask how how do i change the ORDER RECEIVED header as well?
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.
Ben
November 20th, 2017 at 4:57 am
Thank you for this – worked like a charm 🙂
Stuart Edwards
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 🙂
Erin
December 19th, 2017 at 12:25 am
Lifesaver! Thank you!
Ron
December 22nd, 2017 at 8:41 pm
Thank You
joan
November 15th, 2018 at 4:36 am
Hello, how could I translate the new text?
Regards.
Isabel
November 27th, 2018 at 9:44 am
To allow the text to be translated, in the first code block, change line 5 to this:
If you’re using the 2nd code block, change line 5 to this:
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.MM
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.