1
votes

I need to add an additional email address to new order notifications for 'local pickup' shipping method only. So my staff can be notified immediately via those additional email address for new orders when the customer has chosen "Local pickup" from the shipping options.

How to add email recipients to New order notification for Local pickup in Woocommerce?

1

1 Answers

0
votes

I tweaked the above code and it now works.

//Add new email to receive notification when local_pickup is chosen as shipping method
add_filter( 'woocommerce_email_recipient_new_order', 'additional_email_recipient', 10, 2 );
function additional_email_recipient( $recipient, $order ) {
    if ( ! is_a( $order, 'WC_Order' ) ) return $recipient;

    // The shipping method name to target
    if( $order->has_shipping_method('local_pickup') ){
        // Add your recipients comma separated in a unique string
        $recipient .= ',[email protected]';
    }
    return $recipient;
}