Ecommerce Shopify WordPress Discussion

How to send all Woocommerce emails to an additional email address?

I am looking to send all emails to another email in order to parse them (using Sendgrid inbound parse). This is what I currently have: function custom_add_email_address_to_emails( $headers, $object ) { $additional_email = 'additional@example.com'; $headers .= 'Cc: ' . $additional_email . "\r\n"; return $headers; } add_filter( 'woocommerce_email_headers', 'custom_add_email_address_to_emails', 10, 2 ); CC-ing, unfortunately, doesn’t seem to work for inbound parse, so I need to actually add the email as a recipient. Do you know how I might do this?
You can add recipients to WooCommerce pre-defined email notifications using the composite hook woocommerce_email_recipient_{$email_id}. In the code below: You will define the desired email notifications in the first function (See this linked answer for other email IDs), You will define the desired additional recipient (emails) in the 2nd function. The code: add_action('woocommerce_init', 'additional_email_recipient_for_notifications'); function additional_email_recipient_for_notifications(){ // HERE below define the desired email notification $email_ids = array( 'new_order', 'customer_on_hold_order', 'customer_processing_order', 'customer_completed_order', 'customer_refunded_order', 'customer_partially_refunded_order', 'cancelled_order', 'failed_order', ); foreach( $email_ids as $email_id ) { add_filter( "woocommerce_email_recipient_{$email_id}", "additional_email_recipient" ); } } function additional_email_recipient( $recipient ) { if ( is_admin() && isset($_GET['tab']) && $_GET['tab'] === 'email' ) return $recipient; // HERE below define your additional email recipients $additional_recipient = array('additional1@example.com', 'additional2@example.com'); $recipient .= ',' . implode(',', $additional_recipient); return $recipient; } Code goes in functions.php file of your child theme (or in a plugin). Tested and works. Related: Target a specific email notification with the email id in WooCommerce

January 7, 2024

TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.