Skip to content

Instantly share code, notes, and snippets.

@SiR-DanieL
Created January 21, 2015 19:12
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 SiR-DanieL/fdc0dd646d6226f85f88 to your computer and use it in GitHub Desktop.
Save SiR-DanieL/fdc0dd646d6226f85f88 to your computer and use it in GitHub Desktop.
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'] ) ) {
$order_id = absint( $wp->query_vars['order-received'] );
wp_redirect( get_permalink( {PAGE_ID} ) . '?order=' . $order_id );
exit;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment