• Resolved wail523

    (@wail523)


    Hello ,
    first thank you very much for this plugin.
    i would like to know if there any way that after the checkout is happened we let user input another email to send that invoice to another email exemple :

    1-user make an order
    2- thank you page appear with download invoice and other order details
    3- on the thank you page we make an input when user put another email addresse to send the pdf invoice too?

    thank you

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Yordan Soares

    (@yordansoares)

    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.

    Thread Starter wail523

    (@wail523)

    thank you for your answer ,
    and if i make a form in the thank you page and give him the id of the email field of the form , when a user click submit he will receive the email?

    Plugin Contributor Yordan Soares

    (@yordansoares)

    That could be possible, but as I said above, that’s something that is outside the scope of our plugin’s support forum. Perhaps trying with a Google search may help.

    Hope you understand ??

    Thread Starter wail523

    (@wail523)

    I searched but no hope , i will try the function that you gave me , can i put it in function.php?

    Plugin Contributor Yordan Soares

    (@yordansoares)

    Yes, you can use the functions.php file to add the code snippet, but my recommendation is to use it in a child theme (if you do this in your parent theme, you could lose your customizations on next theme updates). Although using the Code Snippets plugin it’s better, and more reliable, in my humble opinion.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Send the pdf invoice to another email’ is closed to new replies.