WooCommerce Admin Only Email Hook

Question

I’m using this to modify the email that is sent to our client for their records, but I don’t want the same info displayed to their customer invoice.

add_action( "woocommerce_email_order_details", "wc_get_transaction");

function wc_get_transaction( $order ) {
    echo '<span style="color:#555;font-size:1.5em;">Transaction ID: '.get_post_meta( $order->id, "_transaction_id", true ).'</span>';

}

I tried this:

if ( ! $sent_to_admin ) {
    add_action( "woocommerce_email_order_details", "wc_get_transaction");

    function wc_get_transaction( $order ) {
        echo '<span style="color:#555;font-size:1.5em;">Transaction ID: '.get_post_meta( $order->id, "_transaction_id", true ).'</span>';

    }
}

Doesn’t work though. I’m using this in my functions.php

How can I get this so it only sends to the admin?

0
, Jarmerson 3 years 2020-05-30T02:11:17-05:00 0 Answers 96 views 0

Leave an answer

Browse
Browse