Remove PDF invoice for custom email recipients
-
Hi !
For my Woocommerce store, I need to send an order email to a third party recipient. I used this code in my functions.php to do so :
/***************/
function add_third_party_email( $recipient, $order ) {
global $woocommerce;
$items = $order->get_items();
foreach ( $items as $item ) {
$product_id = $item['product_id'];
$rechargeable_id = get_wallet_rechargeable_product()->get_id();
// We check if the product is not Wallet recharge or AGRI / TP / PL
if ( $product_id !== 4299 && $product_id !== $rechargeable_id ) {
$additional_email1 = '[email protected]';
if ( ! empty( $additional_email1 ) ) {
$recipient .= ',' . $additional_email1 ;
}
return $recipient;
}
}
}
add_filter( 'woocommerce_email_recipient_new_order', 'add_third_party_email', 10, 2 );/****************/
However, the problem I’m facing now is that I don’t want the third party recipient to have the PDF invoice attached to the order email.
Do you have a solution / code snippet to had to my function in order to achieve this ?
Thanks for your support.
- You must be logged in to reply to this topic.