Continuation of this support ticket https://multivendorx.com/support-forum/topic/send-order-cancelled-email-to-vendor-2/#post-132324
Here is the code I put into functions.php copied from this ticket https://multivendorx.com/support-forum/topic/send-order-cancelled-email-to-vendor/
add_filter( ‘woocommerce_email_recipient_cancelled_order’,’send_custom_email_notifications’,10,2);
add_filter( ‘woocommerce_email_recipient_failed_order’,’send_custom_email_notifications’,10,2);
function send_custom_email_notifications( $recipient, $object ){
$vendor_term = get_vendor_from_an_order($object);
$vendor_email = array();
foreach ($vendor_term as $key => $value) {
$vendor_setails = get_wcmp_vendor_by_term($value);
$vendor_email[] = $vendor_setails->user_data->data->user_email;
}
$vendor_email_convert = implode(” , “,$vendor_email);
$customer_email = $object->get_billing_email();
$recipient .= ‘, ‘ . $vendor_email_convert.’, ‘ . $customer_email;
return $recipient;
}
When I add this code, I get a critical WordPress error. I can only see two emails on the WooCommerce > Settings > Emails page. I’ve attached a screenshot that shows that I only see two emails and that there has been a critical error on the website.
When I don’t add this code, I can see all my emails showing correctly. I’ve attached a second screenshot showing this.
Please can you suggest a fix?