Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 8 You must be signed in to fork a gist
  • Save vishalck/4d9a6f7ffe9705021565909c4a4e8f81 to your computer and use it in GitHub Desktop.
Save vishalck/4d9a6f7ffe9705021565909c4a4e8f81 to your computer and use it in GitHub Desktop.
Redirect to Custom Thank You page in WooCommerce
<?php
add_action( 'template_redirect', 'woo_custom_redirect_after_purchase' );
function woo_custom_redirect_after_purchase() {
global $wp;
if ( is_checkout() && !empty( $wp->query_vars['order-received'] ) ) {
wp_redirect( 'http://localhost:8888/woocommerce/custom-thank-you/' );
exit;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment