How To Customize Your WooCommerce Thank You Page

2
2,404 views
woocommerce thank you page

Whenever a customer makes a purchase on your shop, you should always be grateful to them by showing them an appreciative gesture using a Thank you page. WooCommerce has already done this for you by redirecting customers to the WooCommerce Thank you page after a successful purchase. However, sometimes it’s just not enough. What can you do in this case then?

The simplest thing to do is to redirect customers to another page with your personal contemplations and a thank you message.

First of all, you need to create a custom page:

woocommerce thank you page

Once you have created a new page, the next step is to redirect our customers to this page after they make a purchase. In order to do that, you need to include this code at the end of your theme’s functions.php file:

add_action( 'woocommerce_thankyou', function( $order_id ){
   $order = new WC_Order( $order_id );
   $url = 'http://localhost/wordpress/thank-you/';
   if ( $order->status != 'failed' ) {
       echo "<script type='text/javascript'>window.location = '".$url."'</script>";
   }
});

You can get to the functions.php file here:

woocommerce thank you page

Replace the URL of the page you want your customers to redirect with the one in the code so that whenever a customer makes a successful purchase, they will be automatically redirected to the custom checkout page instead of the default one.

Now, add products to the cart and proceed to checkout.

woocommerce thank you page

After finishing your order, you should be redirected to a page that looks similar to this:

woocommerce thank you page

The end!

Although WooCommerce has already made you a default page, creating a customized thank you page can add some flares of individuality to your brand, and more importantly, you can build a more genuine relationship with new and existing customers.

 

Leave a Reply

2 Comments on "How To Customize Your WooCommerce Thank You Page"

Notify of
avatar
Sort by:   newest | oldest | most voted
Minhaz
Guest

WOW, this is very helpful. Thank you Samantha 🙂

AvZ
Guest

Very nice indeed. But let’s kick it up a notch 🙂 How can we add a client emailaddress on a custom thankyou page? Of an order number? Do you happpen to know this?

wpDiscuz