Skip to content

Instantly share code, notes, and snippets.

@vanbo
Last active October 4, 2017 15:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vanbo/ac2e2713ffb30f419d91 to your computer and use it in GitHub Desktop.
Save vanbo/ac2e2713ffb30f419d91 to your computer and use it in GitHub Desktop.
WC Link Back to the Order in WooCommerce New Order Emails
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