A client of mine wanted to add some text to the thank you page, the page that customers see after they place an order on WooCommerce. In her case, she wanted to add a special offer in order to entice buyers to go back to the website and buy again.

WooCommerce: add text to the thank you page
WooCommerce: add text to the thank you page WooCommerce: add text to the thank you page

PHP Snippet: Add text to the WooCommerce thank you page


/**
 * @snippet       WooCommerce add text to the thank you page
 * @how-to        Get CustomizeWoo.com FREE
 * @sourcecode    https://businessbloomer.com/?p=382
 * @author        Rodolfo Melogli
 * @testedwith    WooCommerce 3.3.4
 */

add_action( 'woocommerce_thankyou', 'bbloomer_add_content_thankyou' );

function bbloomer_add_content_thankyou() {
echo '<h2 class="h2thanks">Get 20% off</h2><p class="pthanks">Thank you for making this purchase! Come back and use the code "<strong>Back4More</strong>" to receive a 20% discount on your next purchase!</p>';
}

PHP Snippet #2: Add text to the WooCommerce thank you page IF payment method is PayPal


/**
 * @snippet       WooCommerce add text to the thank you page for PayPal
 * @how-to        Get CustomizeWoo.com FREE
 * @sourcecode    https://businessbloomer.com/?p=382
 * @author        Rodolfo Melogli
 * @testedwith    WooCommerce 3.3.4
 */

add_action( 'woocommerce_thankyou_paypal', 'bbloomer_add_content_thankyou_paypal' );

function bbloomer_add_content_thankyou_paypal() {
echo '<h2 class="h2thanks">Get 20% off</h2><p class="pthanks">Thank you for making this purchase via PayPal! Come back and use the code "<strong>Back4More</strong>" to receive a 20% discount on your next PayPal purchase!</p>';
}

Share:

Leave a Reply