Skip to content

Instantly share code, notes, and snippets.

@cesgarma
Created January 22, 2022 20:05
Show Gist options
  • Save cesgarma/d1f8a73851bec536816699d3c0ac846a to your computer and use it in GitHub Desktop.
Save cesgarma/d1f8a73851bec536816699d3c0ac846a to your computer and use it in GitHub Desktop.
Preview woocommerce thank you page for an order in the Woocommerce order view
<?php
/**
* Add a button to the order admin panel below the order details that opens the thank you page for that order.
*/
function action_woocommerce_admin_order_data_after_order_details( $order ) {
echo '<a href="' . $order->get_checkout_order_received_url() . '" target="_blank" class="button" style="margin-top:10px">' . __( 'Preview Thank you page', 'woocommerce' ) . '</a>';
}
add_action( 'woocommerce_admin_order_data_after_order_details', 'action_woocommerce_admin_order_data_after_order_details', 10, 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment