The suggestion you gave sound fair, but seems not be working.
I changed my code a little bit becuase I want to add it to de cc (instead to in the beginning),
The code is:
// check if there is an invoice-email of the customer
$addressClass = hikashop_get('class.address');
$address=$addressClass->get($data->data->old->order_billing_address_id);
$invoice_email = $address->invoiceemailadres;
//We add an BCC in case of the parameters say so...
$cc = $this->params->get('copy');
if(!empty($cc)){
$cc = explode(',', $cc);
foreach($cc as $c) {
if(!empty($c))
$mailer->addBCC($c);
}
}
if (!is_null($invoice_email)) {
$mailer->addCC($invoice_email);
}
This is working as i can see in mailtrap.io.
I I look in email-history I see:
As you ca see, the cc-address is missing.
The order of the plugin is as follow:
As last one the email history.
What did i wrong?