あなたは「新規注文」メール通知、こうしてターゲットに、woocommerce_email_recipient_{$this->id}
フィルターフックに引っかけカスタム関数を使用することができます。今後のWooCommerceバージョン2.7の場合
add_filter('woocommerce_email_recipient_new_order', 'diff_recipients_email_notifications', 10, 2);
function diff_recipients_email_notifications($recipient, $order) {
// Set HERE your email adresses
$email_zone1 = '[email protected]';
$email_zone_others = '[email protected]';
// Set here your targeted country code for Zone 1
$country_zone1 = 'GE'; // Germany country code here
// User Country (We get the billing country if shipping country is not available)
$user_country = $order->shipping_country;
if(empty($user_shipping_country))
$user_country = $order->billing_country;
// Conditionaly send additional email based on billing customer city
if ($country_zone1 == $user_country)
$recipient = $email_zone1;
else
$recipient = $email_zone_others;
return $recipient;
}
、いくつかの新しい方法をします請求国と出荷国に関するWC_Abstract_Orderクラスで利用可能ですが、その関数の実際のコードは互換性を維持します。
$order->get_billing_country(); // instead of $order->billing_country;
$order->get_shipping_country(); // instead of $order->shipping_country;
コードは、あなたのアクティブな子テーマ(またはテーマ)のfunction.phpファイルに行く:これらの新しい方法は、それぞれget_billing_country()
とget_shipping_country()
... $順インスタンスオブジェクトと
使用されていますまたは任意のプラグインファイルでも使用できます。
コードがテストされ動作します。
関連の答え:
そして、何あなたが提供するコードが悪いですの? –
これは単なる例です。私が意味していたのは – Mario
あなたが提供した例は上手く見えます。それでは、何を助けてくれるのですか?より多くのコードを提供して、問題をより明確にすることができますか? – akousmata