管理员收到

时间:2016-12-06 13:12:04

标签: php wordpress email woocommerce

在woocommerce订单上添加额外的收件人时,收件人通常会收到与客户收到的邮件相同的邮件。但我想向收件人发送管理员收到的邮件。

以下是我的工作代码,它以客户格式接收电子邮件

add_filter(
    'woocommerce_email_recipient_customer_processing_order',
    'shop_email_recipient_filter_function',
    10,
    2
);
add_filter(
    'woocommerce_email_recipient_customer_completed_order',
    'shop_email_recipient_filter_function',
    10,
    2
);

function shop_email_recipient_filter_function($recipient, $order) {
    $shop = get_post_meta( $order->id, '_restaurant_id', true );
    $shop_owner_email = get_the_author_meta(
        'user_email',
        get_post_field('post_author', $shop)
    );
    $recipient .= ', ' . $shop_owner_email;
    return $recipient;
}

我想发送管理邮件格式

0 个答案:

没有答案