WooCommerce Redirect To Custom Thank You Page

Create a woo-commerce custom thank you page and redirect to this page after checkout successful payment the order? Then you are in right place.  I’ll show you how to create a custom thank you page and redirect to it after checkout successful place order.

The Woocommerce thank you page is where it shows the order details after placing the order.

WooCommerce Redirect to Custom Thank You Page

Before redirecting followed the steps to the place order:

  1. Add product to the cart page.
  2. Fill out the checkout form and select the payment method.
  3. Click on the place order button.

Following the code added to your theme functions.php file.

function tch_woocommerce_custom_thank_you_page_redirect( $order_id ){
    $order = wc_get_order( $order_id );
    $url = 'http://localhost/blog/thank-you/';
     if ( ! $order->has_status( 'failed' ) ) {
        wp_redirect( $url );
        exit;
    }
}

After that place one order and then check it

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe

Select Categories