-
-
Save WPDevHQ/574177466f6c1429c76fcc10ab23e7f0 to your computer and use it in GitHub Desktop.
Woocommerce - custom redirection on checkout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//*Add custom 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( 'http://mysite.com/thank-you-for-your-order/' ); | |
exit; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment