order action : send invoice to admin
-
Hi,
I created a new order action, in order to send to the admin an email with the exact same content as the customer-invoice.php (usualy sent to the customer)
Problem is I can’t get all the content from this email into a new function, here is my code so far :
/* Creating the new order action */
function send_email_to_admin( $actions ) {
global $theorder;$actions[‘wc_custom_order_action’] = ‘Envoyer facture à tagua’;
return $actions;
}
add_action( ‘woocommerce_order_actions’, ‘send_email_to_admin’ );/* Sending the content into a new email */
function process_sending_email_to_admin( $order_id ) {
$order = new WC_Order( $order_id );
$ordernumber = $order->get_order_number();
$ordertotal = $order->get_total();$to = “olivier*********”;
$subject = “Invoice n°”. $ordernumber .” / “. $ordertotal ;
$content = “?”;
$headers = array(‘Content-Type: text/html; charset=UTF-8’);
$status = wp_mail($to, $subject, $content, $headers);
}
add_action( ‘woocommerce_order_action_wc_custom_order_action’, ‘process_sending_email_to_admin’ );Can anyone help me to get the $content set as in the customer invoice please ?
I still have issues with the hooks and get lost with this …Thanks in advance,
Olivier
- The topic ‘order action : send invoice to admin’ is closed to new replies.