1
私はカスタムフィールドを持つチェックアウトフォームを持っています。カスタムフィールドに条件付きでWoocommerce電子メール通知の受信者
カスタムフィールドの値に基づいて注文電子メールに余分な受信者を追加したいと思います。カスタムフィールドは現在、3つのオプションしかないドロップダウンメニューです。
以下は、私がいくつかのグーグルと一緒に作れたコードですが、これは動作しないようです。
function sv_conditional_email_recipient($recipient, $order) {
$custom_field = get_post_meta($orderid, 'custom_field', true);
if ($custom_field == "Value 1")
{
$recipient .= ', [email protected]';
}
elseif ($custom_field == "Value 2")
{
$recipient .= ', [email protected]';
}
elseif ($custom_field == "Value 3")
{
$recipient .= ', [email protected]';
}
return $recipient;
}
add_filter('woocommerce_email_recipient_new_order', 'sv_conditional_email_recipient', 10, 2);
助けていただければ幸いです。
ありがとうございました。