Skip to content

Instantly share code, notes, and snippets.

@KoolPal
KoolPal / mr_wc_new_order_email_recipient.php
Created March 6, 2023 04:43 — forked from monecchi/mr_wc_new_order_email_recipient.php
WooCommerce New Order Email to different recipient based on customer's city
/**
* Add another email recipient for admin New Order emails if a shippable product is ordered for a specific city
*
* @param string $recipient a comma-separated string of email recipients (will turn into an array after this filter!)
* @param \WC_Order $order the order object for which the email is sent
* @return string $recipient the updated list of email recipients
*/
function mr_wc_conditional_email_recipient( $recipient, $order ) {
// Bail on WC settings pages since the order object isn't yet set yet
// Not sure why this is even a thing, but shikata ga nai