• beamkiller

    (@beamkiller)


    Hi Team,

    I am having an issue adding a custom recipient which data is from a custom checkout field named: _shipping_email

    If I use the basic Woo hooks the recipient is added correctly to the email headers but if I try to use an ID from a custom or third-party added order statuses it’s not working.

    Our order statuses:

    My code which is working with the completed, processing statuses which are Woo core statuses:

    add_filter('woocommerce_email_recipient_customer_completed_order', 'custom_email_recipient_alfiok', 10, 2);
    
    function custom_email_recipient_alfiok($recipient, $order) {
    
        // Get the shipping email
        $shipping_email = get_post_meta($order->get_id(),'_shipping_email', true);
    
        // Combine both email addresses if shipping_email exists
        if (!empty($shipping_email)) {
            $recipient .= ',' . $shipping_email;
        }
    
        return $recipient;
    }

    But if I try to use filter like:

    add_filter('woocommerce_email_recipient_customer_beerkezesre-var_order', 'custom_email_recipient_alfiok', 10, 2);
    add_filter('woocommerce_email_recipient_customer_in-transit_order', 'custom_email_recipient_alfiok', 10, 2);

    the recipient is not added.

    Can you please help me how can I add my custom recipient to the custom order status emails?

    Thanks.
    Regards,
    Peter.

  • The topic ‘Adding custom recipient to the emails’ is closed to new replies.