How To Customize WooCommerce Order Thankyou Text

Have you ever wanted to change WooCommerce's default thankyou text from "Thank you. Your order has been received" to something that better represents your brand?

I usually want to add in something about checking their spam folder for the confirmation email if they haven't seen it within 30 minutes.

Before customization, the order received text was standard.

Woocommerce order received page showing default text

Afterwards, I added the information about further instructions being in the email.

Woocommerce order received page showing custom text

I also customized the text based on whether they chose to pick up the order or have it delivered.

To customize the WooCommerce order thankyou text, add a filter to woocommerce_thankyou_order_received_text that returns your message.

If you want to customize the thank you text based on anything to do with the order, you can pass in the order, conditionally process the text and return it. Just be sure to add in the appropriate spaces.

The code to customize the order page thankyou text is:

add_filter( 'woocommerce_thankyou_order_received_text', 'change_received_order_text', 10, 2 );
function change_received_order_text( $text, $order ) {
  $shipping = $order->get_shipping_method();
  $message  = "Thank you. Your order has been received. Please check your email for your receipt and instructions regarding ";
  if ( "Local pickup" == $shipping ) {
    $message .= "picking up";
  } else {
    $message .= "the delivery of";
  $message .= " your order. If you do not see an email from within 30 minutes, please check your spam or junk folder.";
  return esc_html__( $message, 'woocommerce' );  

You may have to play around with what is returned by $shipping. "Local pickup" is the string returned in my particular setup, but yours might be different.

You could also customize based on payment method, category or any other information you have about the product in your setup.

For example, to customize based on payment method, use:

$payment = $order->get_payment_method();

I hope that helps. See you next time.

Mike Haydon

Thanks for checking out my WordPress and coding tutorials. If you've found these tutorials useful, why not consider supporting my work?

Buy me a coffee

Leave a Comment