How i add custom Thank you page in woo commerce

16 Apr How i add custom Thank you page in woo commerce

Following are the steps to create a custom thank you page in woo commerce

1. Create a new page named ‘ Thank you ‘ in wordpress

2. Put this code to Funtion.php .It should be first line after the status

// Redirect custom thank you

add_action( ‘woocommerce_thankyou’, ‘redirectcustom’);

function redirectcustom( $order_id ){
$order = new WC_Order( $order_id );

$url = ‘http://yoursite.com/custom-url’;

if ( $order->status != ‘failed’ ) {
wp_redirect($url);
}
}

 

Hope it is working for you ![/vc_column_text][/vc_column][/vc_row]