Forked from bekarice/wc-admin-view-thankyou-link.php
Created
September 5, 2019 08:44
-
-
Save shamimsdp/09da7c4f60dd247685c3231b0eb77f56 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // only copy if needed! | |
/** | |
* Adds a link to view the "order received" page to the orders admin. | |
* REQUIRES WC 3.0+ | |
* | |
* @param \WC_Order $order the current order object | |
*/ | |
function sv_wc_order_received_page_admin_link( $order ) { | |
if ( $order instanceof WC_Order ) { | |
$args = array( | |
'order-received' => $order->get_id(), | |
'key' => $order->get_order_key(), | |
); | |
ob_start(); | |
?> | |
<?php /* incorrect CSS class added here so it adopts styling we want */ ?> | |
<p class="form-field form-field-wide wc-order-received wc-order-status"> | |
<label for="order_received"> | |
<?php esc_html_e( 'Order receipt:', 'my-textdomain' ); ?> | |
<?php printf( '<a href="%s" target="_blank" rel="noopener">%s</a>', | |
esc_url( add_query_arg( $args, wc_get_checkout_url() ) ), | |
__( 'View thank you page →', 'my-textdomain' ) | |
); ?> | |
</label> | |
</p> | |
<?php | |
echo ob_get_clean(); | |
} | |
} | |
add_action( 'woocommerce_admin_order_data_after_order_details', 'sv_wc_order_received_page_admin_link', 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment