Hi @wail523,
That is quite complex, and it’s something that is beyond our plugin’s support, but you could add a custom email field to your checkout instead, using the Checkout Field Editor for instance, and then adding this code snippet to your site to send a copy of the Completed order and Processing order email notifications to the email address entered by your customers (if any):
/**
* Receive a copy of the invoices sent by email using a checkout email custom field
*/
add_filter( 'woocommerce_email_headers', 'woocommerce_emails_bcc_copy', 10, 3);
function woocommerce_emails_bcc_copy( $headers, $email_id, $order, $email = null ) {
// If the email notification is 'Completed order' or 'Processing order'
if ( in_array( $email_id, array('customer_completed_order', 'customer_processing_order') ) ) {
// replace 'extra_email_address' below for your actual custom field meta key
if ( $extra_email_address = $order->get_meta( 'extra_email_address' ) ) {
$billing_full_name = $order->get_formatted_billing_full_name();
$headers .= 'BCC: ' . $billing_full_name . ' <' . $extra_email_address . '>' . "\r\n";
}
}
return $headers;
}
You also have to select the Completed order and/or Processing order email notifications under WooCommerce > PDF Invoices > Documents > Invoice > Attach to to attach the invoice to these email notifications.