Solved 1st:
If you want to redirect a customer to a different page rather than the Thank you page, like for example, the My account page, you can do that adding this code in the file functions.php
located in wp-content/themes/your-theme-name/:
================================================================================
1 2 3 4 5 6 7 8 9 |
add_action( 'template_redirect', 'wc_custom_redirect_after_purchase' ); function wc_custom_redirect_after_purchase() { global $wp; if ( is_checkout() && ! empty( $wp->query_vars['order-received'] ) ) { wp_redirect( 'http://www.yoururl.com/your-page/' ); exit; } } |
================================================================================
Solved 2nd:
You could modify the “Thank you” page template to include a simple redirect via javascript. The page is titled “Order Received” by default. The template file itself is in the woocommerce plugin directory unless your theme has a set of checkout page templates.
Look in your theme directory for this file:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
woocommerce/checkout/thankyou.php If it exists, edit that to include a javascript redirect. If it doesn't exist, copy it from wp-content/plugins/woocommerce/templates/checkout/thankyou.php to wp-content/themes/YOUR_THEME/woocommerce/checkout/thankyou.php Add this in script tag: window.location = 'Url here' |