wplaunchify
6/28/2018 - 2:26 PM

Redirect After Purchase (Custom ThankYou Page Global)

Redirect immediately after checkout - used for a global thank you page or redirection.

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

	if ( is_checkout() && ! empty( $wp->query_vars['order-received'] ) ) {
		wp_redirect( 'https://wpsandbox.demo.site/my-account/' );
		exit;
	}
}