Last active
October 4, 2017 15:37
-
-
Save vanbo/ac2e2713ffb30f419d91 to your computer and use it in GitHub Desktop.
WC Link Back to the Order in WooCommerce New Order Emails
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
add_action( 'woocommerce_email_after_order_table', 'add_link_back_to_order', 10, 2 ); | |
function add_link_back_to_order( $order, $is_admin ) { | |
// Only for admin emails | |
if ( ! $is_admin ) { | |
return; | |
} | |
// Open the section with a paragraph so it is separated from the other content | |
$link = '<p>'; | |
// Add the anchor link with the admin path to the order page | |
$link .= '<a href="'. admin_url( 'post.php?post=' . absint( $order->id ) . '&action=edit' ) .'" >'; | |
// Clickable text | |
$link .= __( 'Click here to go to the order page', 'your_domain' ); | |
// Close the link | |
$link .= '</a>'; | |
// Close the paragraph | |
$link .= '</p>'; | |
// Return the link into the email | |
echo $link; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment