Skip to content

Instantly share code, notes, and snippets.

@anant1811
Last active September 28, 2016 07:11
Show Gist options
  • Save anant1811/91af8cdb8d676695ab2c60bf9d44e2af to your computer and use it in GitHub Desktop.
Save anant1811/91af8cdb8d676695ab2c60bf9d44e2af 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