add recipients to "Customer invoice / Order details" in Woocommerce emails

In Woocommerce, there is already a built-in way to add recipients to the "New Order" , "Failed", and "Cancelled" emails, but for some reason, the "Customer invoice / Order details" don't allow any recipient other than the customer.

There is a simple plugin that allows for that, but it is very limited in features.

Any guidance for how to add recipients to this email?

I plan to use a Code Snippet to call the hook/filter/action and then tell it explicitly which email addresses to use. I intend to write the script so that whatever user initiates the action, will be CC'ed on that email. Presumably the same function that can do the first part of my question can help me to check current user and will grab their email address.

Any help is appreciated

Solutions

I don't know what buil-in functionality are you talking about. But you can use the below filter to add recipients to the invoice email. You don't need any plugin, just use this below code snippet in your active theme/child theme functions.php

add_filter("woocommerce_email_recipient_customer_invoice", "add_recipient_to_email", 10, 2);
function add_recipient_to_email( $recipients, $object ){
    $new_email = "[email protected]"; //New email Id
    $recipients = $recipients.','.$new_email;
    return $recipients;
}
Tags: PHP / Wordpress / Email

Similar questions

Add multiple recipients via BCC on wp_mail()
I created a function which returns an array of email addresses: This is the given array: How can I add this emails to the headers array that it looks like this?
php mailer | Add multiple recipients | WordPress
I'm working on a classified website, where users are able to publish whatever they want to sell or advertise from the front end. At the end of each published post, a client can get in touch with the seller by filling in a contact form. By default, the email goes to the publisher. The function $ contact_email, is the publisher's email address. Howev...
Woocommerce Emails - Sending multiple emails based on product count
In Woocommerce, I have a Course product that uses WC Fields to collect student[s] names and email addresses, and custom email template that sends an email when this course product is purchased. As of now, based on the answer in this thread, I am able to collect the email addresses added to those custom fields and send one email to each student as a...
Remove unused emails from Woocommerce settings emails list
A few days ago I've asked how I can rename custom email templates in WooCommerce. Now I have the problem that I have some email templates which I don't need and I want to hide these templates completely. How can I do this? I've searched on SO and Google but can't find a tutorial.
Adding recipients to Woocommerce email notifications based on product variation term
I have created a Woocommerce plugin and require it to do two things: Send a notification message to a specific email address, based on which product variation is in the cart. The email must contain only the relevant product, and not products that contain other attributes. For example: Product A has an Attribute named Chef, with chef-one and chef-tw...
Different recipients based on product category in WooCommerce email notification
I am setting up a site for a school that sells both virtual products (fees and excursion payments) and Physical (uniforms) however they would like to have order notifications for each category to be sent to separate recipients as they are dealt with by different departments. For example all uniform category orders are to go to recipient one, while ...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.