Skip to content

Instantly share code, notes, and snippets.

@WPDevHQ
Forked from anant1811/woo-custom-redirect
Created August 6, 2016 23:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WPDevHQ/574177466f6c1429c76fcc10ab23e7f0 to your computer and use it in GitHub Desktop.
Save WPDevHQ/574177466f6c1429c76fcc10ab23e7f0 to your computer and use it in GitHub Desktop.
Woocommerce - custom redirection on checkout
//*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