How to Customize WooCommerce Order Received Page

WooCommerce Custom Order Received PageAre you looking for a way to redirect customers to a custom order received page?

The order received page is one of the most important pages in any WooCommerce store. This is the last page that a user interacts with after completing a purchase. The importance of having the thank you page is hard to overestimate.

You can have a great product or service to sell, but if you have a stunning thank you page with a nice customized message, they are likely to become repeat customers.

By default, WooCommerce provides you with a simple thank you page. It is a good start, but you might want to redirect them to a custom page that you have created.

WooCommerce Custom Order Received Page

By the end of this post, you will be able to redirect your customers to a custom thank you page. You can use a plugin to do this, but they end up bloating your site.

The recommended way is to use a custom PHP script.

Let us see how you can achieve this.

Steps to Create a Custom Order Receive Page

In this section, we will use a custom PHP code snippet to redirect users to a welcome page after they have completed their purchase.

Here are the simple steps you need to follow:

  1. Log into your WordPress site and access the Dashboard as the admin user.
  2. From the Dashboard menu, click on Appearance Menu > Theme Editor Menu. When the Theme Editor page is opened, look for the theme functions file where we will add the function that will redirect customers after checkout.
  3. Add the following code to the functions.php file:
  1. Log into your WordPress site and access the Dashboard as the admin user.
  2. From the Dashboard menu, click on Appearance Menu > Theme Editor Menu. When the Theme Editor page is opened, look for the theme functions file where we will add the function that will redirect customers after checkout.
  3. Add the following code to the php file:
add_action( 'woocommerce_thankyou', 'njengah_redirect_custom');

function njengah_redirect_custom( $order_id ){

$order = wc_get_order( $order_id );

 $url = 'https://yoursite.com/custom-url';

 if ( ! $order->has_status( 'failed' ) ) {

 wp_safe_redirect( $url );
 exit;

 }

}
  1. This is the outcome:custom thank you page

How the Code Works

The code snippet redirects the customer to a custom page after the user has completed a purchase.

It checks if the user has completed their purchase, and redirects them to the URL. Remember to replace the URL of the appropriate page for this code to work.

Your custom page should be beautifully designed to improve the user experience on your site.

Conclusion

By now, you should be able to redirect customers to a custom page after they complete a purchase.

Welcome pages are great ways to upsell a product, include referrals, or educate customers about your product. You can also include discounts or coupons on this page to entice new and loyal customers.

Similar Articles

  1. How to Hide Product Prices Based on User Role Storefront

Customer Reviews

NJENGAH

Customer Reviews

Jeffrey Todd 04/07/2020

Exceptional Plugin & Service

I'm in the process of building my new website, and I had a question about changing some text within the WooCommerce plugin. I was spinning my wheels trying to figure it out. Joe reached back and worked with me - going above and beyond! - until I fully understood how to effectively change what I wanted. How can you ask for more than that? I highly recommend WooCommerce (and Joe!), the plugin and service are exceptional!
-Jeffrey Todd (MyLifeChart.com)