WooCommerce: View Thank You Page @ Order Admin

I’ve been testing for over an hour but finally I found a way to make this work. When you are in “Edit Order” view under WordPress Dashboard > WooCommerce > Orders, there is a dropdown of “Order actions”: “Email invoice”, “Resend new order notification”, etc.

A major problem I’ve always had while troubleshooting or working on the WooCommerce thank you page was that I had to build that URL by hand in order to view it again or to avoid placing yet another test order (it follows the format e.g. https://example.com/checkout/order-received/214008/?key=wc_order_aHB6YrmLOZIKP).

Well, from today, you can access that order thank you page URL directly from the “Order actions” dropdown. Enjoy!

Here’s our brand new order action: “Display thank you page”. Simply select and then click on the right arrow, and you will be automatically redirected to the order’s thank you page!

PHP Snippet: Add “View Thank You Page” to “Order actions” @ Edit Order WP Admin Pages

Note: remove the $order->has_status() check if you wish this to appear for ALL order statuses.

/**
 * @snippet       View Thank You Page @ Edit Order Admin
 * @how-to        Get CustomizeWoo.com FREE
 * @author        Rodolfo Melogli
 * @compatible    WooCommerce 6
 * @donate $9     https://businessbloomer.com/bloomer-armada/
 */

add_filter( 'woocommerce_order_actions', 'bbloomer_show_thank_you_page_order_admin_actions', 9999, 2 );

function bbloomer_show_thank_you_page_order_admin_actions( $actions, $order ) {
	if ( $order->has_status( wc_get_is_paid_statuses() ) ) {
		$actions['view_thankyou'] = 'Display thank you page';
	}
	return $actions;
}

add_action( 'woocommerce_order_action_view_thankyou', 'bbloomer_redirect_thank_you_page_order_admin_actions' );

function bbloomer_redirect_thank_you_page_order_admin_actions( $order ) {
	$url = $order->get_checkout_order_received_url();
	add_filter( 'redirect_post_location', function() use ( $url ) {
		return $url;
	});
}

Where to add this snippet?

You can place PHP snippets at the bottom of your child theme functions.php file (delete "?>" if you have it there). CSS, on the other hand, goes in your child theme style.css file. Make sure you know what you are doing when editing such files - if you need more guidance, please take a look at my free video tutorial "Where to Place WooCommerce Customization?"

Does this snippet (still) work?

Please let me know in the comments if everything worked as expected. I would be happy to revise the snippet if you report otherwise (please provide screenshots). I have tested this code with Storefront theme, the WooCommerce version listed above and a WordPress-friendly hosting on PHP 7.3.

If you think this code saved you time & money, feel free to join 14,000+ WooCommerce Weekly subscribers for blog post updates or 250+ Business Bloomer supporters for 365 days of WooCommerce benefits. Thank you in advance :)

Need Help with WooCommerce?

Check out these free video tutorials. You can learn how to customize WooCommerce without unnecessary plugins, how to properly configure the WooCommerce plugin settings and even how to master WooCommerce troubleshooting in case of a bug!

Rodolfo Melogli

Business Bloomer Founder

Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as an independent WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza.

10 thoughts on “WooCommerce: View Thank You Page @ Order Admin

  1. Thank you very much! excellent.
    Can you help me put a link similar to this one on the My Account page? With that the customer has access when they need it.

    1. Hi Ricardo, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

  2. Never thought about this functionality, but now I need to test and see it working 🙂

    Thanks for the codes but thank you even more for the different approaches and way of thinking that you bring here

  3. Hey Rodolfo !
    This one is brilliant, thanks !
    Although I already see a few case in which such a function can be useful, would you mind telling us more about why you implemented it so far ?

    1. Cool! For example I use it while troubleshooting Thank you page errors, or checking if Thank you page customization is working

  4. Hi Rodolfo,

    Thank you for thinking of sharing this snippet. It works great but what happens if you use a custom Thank You Page that includes extra content before the order details? How can we display that content here?

    Lyse

    1. This only works with the default WooCommerce thank you page, sorry. Though, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

  5. Very, very needed 🙂 Magic! Thank You!

Questions? Feedback? Support? Leave your Comment Now!
_____

If you are writing code, please wrap it between shortcodes: [php]code_here[/php]. Failure to complying with this (as well as going off topic, not writing in English, etc.) will result in comment deletion. You should expect a reply in about 2 weeks - this is a popular blog but I need to get paid work done first. Please consider joining BloomerArmada to get blog comment reply priority, ask me 1-to-1 WooCommerce questions and enjoy many more perks. Thank you :)

Your email address will not be published.