我想在有新订单时设置电子邮件地址。我将新的电子邮件存储在wp_postmeta
中。
使用woocommerce_email_headers
时如何获取$order_id
?
我需要获取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);
我该如何恢复数据?
谢谢。
$object
可能有$order_id
吗? - Capslock10