Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Woocommerce - Redirect after payment
<?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;
}
}
@pintolog

This comment has been minimized.

Copy link

pintolog commented Oct 15, 2019

Is it possible to redirect the user to the course page after purchase,
so here:
wp_redirect( 'http://www.yoururl.com/your-page/' );
the url will be the course page that the user bought?

@mshafeel039

This comment has been minimized.

Copy link

mshafeel039 commented Jul 24, 2020

How to redirect to the specific learndash course page purchased?

@webmasterninjay

This comment has been minimized.

Copy link
Owner Author

webmasterninjay commented Jul 24, 2020

I suggest to use the Custom Thank You page plugin for WooCommerce https://wordpress.org/plugins/wc-custom-thank-you/

You will need to edit each Learn Dash Product in Woocommerce and manually add the course page url in the plugin field.

@mshafeel039

This comment has been minimized.

Copy link

mshafeel039 commented Jul 24, 2020

Thank you, what about a custom code? without using the plugin?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.