After completing the purchase, the customer lands on a thank you page – one of the most important moments of contact with the brand. A properly personalized message can increase customer satisfaction, encourage further purchases, and strengthen trust in the store.
WooCommerce 9.1.27 offers various methods to customize this page – from simple hooks, through template modifications, to using ready-made plugins.
The simplest way to add an additional message to the thank you page is to use a WooCommerce hook.
To do this, add the following code to your theme’s functions.php file or your own plugin:
“`
function wlasna_wiadomosc_po_zamowieniu($order_id) {
if (!$order_id) return;
$message = ‘Thank you for your purchase!’;
echo ‘
‘ . $message . ‘
‘;
}
add_action(‘woocommerce_thankyou’, ‘wlasna_wiadomosc_po_zamowieniu’);
“`
You can also use a plugin to create dynamic content, such as a promo code or suggestions for purchases.
Here’s an example of adding a promo code:
“`
function kod_rabatowy_na_stronie_dziekujemy($order_id) {
if (!$order_id) return;
$code = ‘DZIĘKI10’;
echo ‘
Jako wyraz wdzięczności, skorzystaj z kodu ‘ . $code . ‘ i otrzymaj 10% zniżki na kolejne zakupy!
‘;
}
add_action(‘woocommerce_thankyou’, ‘kod_rabatowy_na_stronie_dziekujemy’);
“`
This type of encouragement to return to the store can significantly increase customer retention.
After implementing changes, it’s a good idea to thoroughly test their functionality:
* Does the message display correctly after a purchase?
* Is the promo code working?
* Are there any HTML/JS errors?
* Does the content look good on mobile devices?
The best approach is to perform a test order and analyze the “Thank you” page from the customer’s perspective.
Here are three main paths:
1. Simple hooks (e.g., `woocommerce_thankyou`)
2. Modifying the `thankyou.php` template
3. Installing visual plugins for content editing
Regardless of the method, always make a backup copy and test changes in a testing or staging environment.