Woocommerce: Redirect to Custom Thank you Page
-
Hi there,
Having never added anything to my WP Editor could someone please advise of this…
simply add some code to our core_functions.php and redirect buyers to a custom thank you page
Where in the functions.php do I add this code?
// Redirect custom thank you
add_action( ‘woocommerce_thankyou’, ‘redirectcustom’);
function redirectcustom( $order_id ){
$order = new WC_Order( $order_id );$url = ‘https://yoursite.com/custom-url’;
if ( $order->status != ‘failed’ ) {
wp_redirect($url);
}
}Right at the very beginning after the <?php
Just checking as I really don’t want to mess anything up.
Many thanks, Pete
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Woocommerce: Redirect to Custom Thank you Page’ is closed to new replies.