我正在尝试在有新订单时设置电子邮件地址。我存储new email
在wp_postmeta
.
$order_id
使用时如何获取woocommerce_email_headers
?
我需要order_id
使用它来使用它的get_post_meta()
功能。
这是我的代码:
function techie_custom_wooemail_headers( $headers, $object) {
$email = get_post_meta( $order_id, '_approver_email', true );
// Replace the emails below to your desire email
$emails = array('eee@hotmail.com', $email);
switch($object) {
case 'new_order':
$headers .= 'Bcc: ' . implode(',', $emails) . "\r\n";
break;
case 'customer_processing_order':
$headers .= 'Bcc: ' . implode(',', $emails) . "\r\n";
break;
case 'customer_completed_order':
case 'customer_invoice':
$headers .= 'Bcc: ' . implode(',', $emails) . "\r\n";
break;
default:
}
return $headers;
}
add_filter( 'woocommerce_email_headers', 'techie_custom_wooemail_headers', 10, 2);
如何取回数据?
谢谢。