• Resolved dacano_1990

    (@dacano_1990)


    Hi,

    Firstly, this is a fantastic plugin. I just wanted to know is there anyway to send CC or BCC based on the products? For eg. I have different products from different people. I wanted to know if it would be possible to send email to different people based on the product purchased?

    Thanks and Regards,

    David

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author dcurasi

    (@dcurasi)

    It’s possible, but at present this plugin is not able to do that.
    It’s an idea for the next updates.
    To do this you should modify the function “custom_headers_email_function” in the file class-dc-dc-bcc-woe-public.php in my plugin.
    Take the products of the order and according to them, choose who send the email.
    For example:

    function custom_headers_email_function( $headers, $object ) {
    		global $woocommerce;
    
            $items = WC()->cart->get_cart();
            $list_products = array();
            foreach($items as $item => $values) { 
                $_product = $values['data']->post;
                array_push($list_products, $_product->ID);
            }
    		if(get_option('dc_wech_new_order')) {
    		    if ($object == 'new_order') {
    		    	if(in_array(8, $list_products)) {
    		    	$headers .= 'CC: [email protected]' . "\r\n";
    		        $headers .= 'BCC: ' . get_option('dc_wech_email_list_bcc') . "\r\n";
    		    }
    		    }
    		}
    ...
    }

    sends the new order email to [email protected] only if the product with id = 8 is in the order.

    If you like the plugin, please give it a rating.

    Dario Curasi

    Thread Starter dacano_1990

    (@dacano_1990)

    Hello dcurasi,

    Thanks for the reply. It works great, but the emails and product ids would have to be entered in the code after every product has been added right?

    Thanks,

    David

    Plugin Author dcurasi

    (@dcurasi)

    Yes, unfortunately it is currently the only solution.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Send CC based on product?’ is closed to new replies.