Created
July 10, 2015 14:41
-
-
Save webmasterninjay/45fd3fad114a6a4a2862 to your computer and use it in GitHub Desktop.
Woocommerce - 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
<?php | |
/* Redirect user after check out */ | |
add_action( 'template_redirect', 'jay_custom_redirect_after_purchase' ); | |
function jay_custom_redirect_after_purchase() { | |
global $wp; | |
if ( is_checkout() && ! empty( $wp->query_vars['order-received'] ) ) { | |
wp_redirect( 'http://www.yoururl.com/your-page/' ); | |
exit; | |
} | |
} |
How to modify this code for Redirect to a custom page after checkout based on the user role?
For the membership function, I am using the Ultimate member plugin.
How can I use this code to redirect to the specific course the user purchases?
I have 4 courses on my website, and the user can buy any of the four
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you, what about a custom code? without using the plugin?