How to set up and customize the Thank You page for a purchase in WooCommerce?

WooCommerce, as one of the most frequently used e-commerce platforms on WordPress, allows for customizing the customer experience after a purchase has been made. One element that is worth personalizing is the order thank you message.

You can customize it in several ways – either using code or dedicated plugins.

Below, you’ll find an overview of the most popular methods for personalizing the “Thank You” message in WooCommerce.

1. Default WooCommerce Thank You Page
After a purchase has been made, the customer is redirected to the order confirmation page, which includes details about the order and a standard thank you message.

To check this page:

* Go to WooCommerce → Settings → Advanced
* In the section “Endpoints for Order Completion,” find the entry “order-received” – this is actually the Thank You page

WooCommerce does not allow direct editing of this message from the dashboard, but you can do it using one of the methods described below.

2. Adding Your Own Message via functions.php
If you want to customize the message without using plugins, you can add a fragment of code to your theme’s functions.php file.

Example code:
“`php
add_action(‘woocommerce_thankyou’, ‘custom_thank_you_message’, 20);

function custom_thank_you_message($order_id) {
$order = wc_get_order($order_id);
echo ‘

Thank you for the purchase!

‘;
echo ‘

We hope you enjoyed shopping with us. Please let us know if you have any questions or concerns.

‘;
}
“`
This code replaces the default message with your own text visible after a purchase.

3. Customizing the Thank You Page Using Plugins
For those who don’t want to work with code, there are plugins available that allow for easy customization of the Thank You page.

See also  Real-Time Marketing

Recommended plugins:

* WooCommerce Custom Thank You Pages – allows you to assign different Thank You pages to different products
* NextMove Lite – Thank You Page Editor – offers a user-friendly interface for editing the Thank You message
* WPML String Translation – allows for translation of the Thank You message

4. Dynamic Message Using Order Data
You can also display a more personalized message that includes the customer’s name or order number.

Example code:
“`php
add_action(‘woocommerce_thankyou’, ‘custom_dynamic_thank_you’, 10, 1);

function custom_dynamic_thank_you($order_id) {
$order = wc_get_order($order_id);
$customer_name = $order->get_billing_first_name();
echo ‘

Thank you, ‘ . esc_html($customer_name) . ‘!

‘;
echo ‘

Order number: ‘ . esc_html($order->get_order_number()) . ‘

‘;
}
“`
This code allows the customer to see a more personalized message that can positively impact their shopping experience.

5. Redirecting to a Custom Page
You can also redirect the customer to a custom page created by you using a PHP function.

Example code:
“`php
add_action(‘template_redirect’, ‘custom_thank_you_redirect’);

function custom_thank_you_redirect() {
if (is_wc_endpoint_url(‘order-received’)) {
wp_redirect(site_url(‘/my-thanks’));
exit;
}
}
“`
Replace `/my-thanks` with the slug of the page you created.

Conclusion
A well-designed Thank You page is more than just a formality – it’s an opportunity to strengthen trust and encourage customers to return. With these methods, you can create a unique and personalized experience for your customers that sets your brand apart from others.