WooCommerce, one of the most popular eCommerce platforms for WordPress, provides various ways to customize the post-purchase experience for customers. One of these customizations includes setting up a thank-you message to acknowledge and appreciate customers after they complete a purchase. This article explores different ways to set up and customize the thank-you message in WooCommerce.
1. Default WooCommerce Thank You Page
By default, WooCommerce redirects customers to an order confirmation page after they complete a purchase. This page contains details of the order and a default thank-you message. To modify this page, follow these steps:
- Navigate to WooCommerce > Settings > Advanced.
- Locate the “Checkout endpoints” section.
- Look for the “Order received” endpoint, which controls the thank-you page.
While WooCommerce does not provide a built-in option to directly edit the message, you can customize it using different methods, as outlined below.
2. Customizing the Thank You Message Using Functions.php
To personalize the thank-you message, you can modify your theme’s functions.php
file by adding a custom function. Here’s an example code snippet to change the default thank-you message:
add_action('woocommerce_thankyou', 'custom_thank_you_message', 20);
function custom_thank_you_message($order_id) {
$order = wc_get_order($order_id);
echo '<h2>Thank You for Your Purchase!</h2>';
echo '<p>We appreciate your business and hope you enjoy your products.</p>';
}
This code snippet hooks into the WooCommerce thank-you page and replaces the default message with a custom one.
3. Using WooCommerce Thank You Page Plugins
If you prefer a no-code approach, you can use plugins that allow you to customize the thank-you page easily. Some popular plugins include:
- WooCommerce Custom Thank You Pages – Allows you to design a unique thank-you page per product.
- NextMove Lite – Thank You Page Customizer for WooCommerce – Provides templates and custom blocks to enhance the thank-you page.
- YITH Custom Thank You Page for WooCommerce – Enables redirection to a custom thank-you page after checkout.
To install a plugin:
- Go to Plugins > Add New in your WordPress dashboard.
- Search for the plugin by name.
- Click Install Now and then Activate.
- Configure the plugin settings under WooCommerce or the respective plugin tab.
4. Creating a Custom Thank You Page in WordPress
If you want full control over the thank-you page, you can create a new page in WordPress and set it as the thank-you page using a WooCommerce redirect.
- Create a new page in WordPress and design it using Gutenberg, Elementor, or another page builder.
- Redirect the default WooCommerce thank-you page to your new page by adding the following code to
functions.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('/custom-thank-you-page'));
exit;
}
}
Replace /custom-thank-you-page
with the actual slug of your custom page.
5. Personalizing Thank You Messages Based on Order Details
You can make the thank-you message dynamic by displaying customer details, purchased products, or order numbers using 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 '<h2>Thank You, ' . esc_html($customer_name) . '!</h2>';
echo '<p>Your order number is ' . esc_html($order->get_order_number()) . '.</p>';
}
This snippet customizes the message to include the customer’s name and order number.
Conclusion
Setting up a thank-you message in WooCommerce can be done in multiple ways, depending on your needs. Whether you modify the functions.php
file, use a plugin, or create a fully customized thank-you page, enhancing this part of the customer journey can improve user experience and encourage repeat purchases.
By personalizing the thank-you page, you can build stronger relationships with customers, provide additional marketing opportunities, and create a lasting impression.