Created
March 29, 2021 22:34
-
-
Save DeveloperWil/417943724fd9337585b9901a2b39f1cc to your computer and use it in GitHub Desktop.
WooCommerce: Global redirect after payment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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