Customize the Thank you page in WooCommerce

Whenever a customer makes a purchase on your shop, you should always be grateful to them by showing them an appreciative gesture using a Thank you page. WooCommerce has already done this for you by redirecting customers to the WooCommerce Thank you page after a successful purchase. However, sometimes it’s just not enough. What can you do in this case then?

The simplest thing to do is to redirect customers to another page with your personal thoughts and a thank you message.

To do so, add this following code in your theme’s functions.php file of your active child theme (or theme).

add_action( 'template_redirect', 'thankyou_redirect_after_purchase' ); 
function thankyou_redirect_after_purchase() {
	global $wp;

	if ( is_checkout() && ! empty( $wp->query_vars['order-received'] ) ) {
		wp_redirect( 'http://www.yoururl.com/your-page/' );
		exit;
	}
}
Scroll to Top