The default text on the WooCommerce Thank You page, such as order details and additional information, can be customized to provide a more personalized post purchase experience for your customers. With the help of a simple code, you can easily modify this text to match your store’s tone and style.
Change Thank You Page Text
/**
* Snippet Name: Change the thank you page text
* Snippet Author: wpsnippets.dev
*/
//change the thank you page text
function wps_custom_thankyou_page_text( $thankyou_text, $order ) {
// Change the thank you page text here
$thankyou_text = 'Your custom thank you page text goes here.';
return $thankyou_text;
}
add_filter( 'woocommerce_thankyou_order_received_text', 'wps_custom_thankyou_page_text', 10, 2 );
Code Explanation
- This code snippet utilizes the woocommerce_thankyou_order_received_text filter hook to modify the text displayed on the Thank You page.
- The custom_thankyou_page_text function takes two parameters: the default thank you page text ($thankyou_text) and the order object ($order).
- Within the function, you can replace the default text with your desired custom message.
- Finally, the modified text is returned to be displayed on the Thank You page.