Skip to content

Instantly share code, notes, and snippets.

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 DeveloperWil/417943724fd9337585b9901a2b39f1cc to your computer and use it in GitHub Desktop.
Save DeveloperWil/417943724fd9337585b9901a2b39f1cc to your computer and use it in GitHub Desktop.
WooCommerce: Global redirect after payment
/* Redirect user after check out */
function zpd_wc_global_redirect_after_payment() {
global $wp;
$redirect_url = 'https://yourdomain.com/this-page/';
if ( is_checkout() && ! empty( $wp->query_vars['order-received'] ) ) {
wp_redirect( $redirect_url );
exit;
}
}
add_action( 'template_redirect', 'zpd_wc_global_redirect_after_payment' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment