Skip to content

Instantly share code, notes, and snippets.

@LaurenaRehbein
Created May 8, 2018 19:51
Show Gist options
  • Save LaurenaRehbein/84c1334bb6339325ffcfec06850956f4 to your computer and use it in GitHub Desktop.
Save LaurenaRehbein/84c1334bb6339325ffcfec06850956f4 to your computer and use it in GitHub Desktop.
Custom thank you page redirect
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://www.yoururl.com/your-page/' );
exit;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment