Written on 8. June 2022 by Lennart Christensen

Display the thank you for your order URL in woocommerce

If you need to find the url for "thank you for your order" in WooCommerce for a given order then you can use this short function to find the url 🙂

Remember to change your username to your own. The url is printed in the header. $pid is changed to the postid of the order you want to check.

/*--------------------------------------------------------------
Get Order Thank You Page Url
--------------------------------------------------------------*/
if (is_user_logged_in() && strtolower($tuser->user_login) == 'lennartc') {
	function print_order_url($pid = 99 ){
	$order = new WC_Order( $pid );
	echo $order;
} add_action('wp_head', 'print_order_url');
}