简体   繁体   English

在新用户通知电子邮件中包含WooCommerce地址

[英]Include WooCommerce Address in New User Notification Email

I'm trying to include the address entered by a customer, in the email received by the admin. 我正在尝试在管理员收到的电子邮件中包含客户输入的地址。

I can see that the email is being pulled in via... 我可以看到该电子邮件是通过...提取的

$user->user_email

which is obtained via... 通过...获得

$user = get_userdata( $user_id );

I thought something along the following would work to pull the post code in... 我认为以下内容可以将邮政编码插入...

$user->user_postcode

http://codex.wordpress.org/Function_Reference/get_userdata suggests that... http://codex.wordpress.org/Function_Reference/get_userdata建议...

get_userdata

and

get_user_meta

can't be used to pull WooCommerce address info in, so I looked for something that would pull this information in and tried... 不能用来提取WooCommerce地址信息,所以我寻找了可以提取此信息的东西,然后尝试...

global $woocommerce;
$test = get_user_meta( $current_user->ID, 'billing_postcode', true );

with... 与...

$message .= sprintf(__('Post Code: %s'), $test) . "\r\n";

Would someone be able to inform me of a similar option to get_userdata that will work with WooCommerce address info? 有人可以通知我与get_userdata类似的选项,它将与WooCommerce地址信息一起使用吗?

global $woocommerce;
$customer_address = $woocommerce->customer->get_address();
$customer_address_2 = $woocommerce->customer->get_address_2();
$customer_city = $woocommerce->customer->get_city();
$customer_state = $woocommerce->customer->get_state();
$customer_postcode = $woocommerce->customer->get_postcode();

$message .= sprintf(__('Address Line 1: %s'), $customer_address) . "\r\n\r\n";
$message .= sprintf(__('Address Line 2: %s'), $customer_address_2) . "\r\n\r\n";
$message .= sprintf(__('City: %s'), $customer_city) . "\r\n\r\n";
$message .= sprintf(__('County: %s'), $customer_state) . "\r\n\r\n";
$message .= sprintf(__('Post Code: %s'), $customer_postcode) . "\r\n";

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将客户电子邮件地址添加到WooCommerce中的新帐户电子邮件通知 - Add customer email address to new account email notification in WooCommerce Wordpress-新用户通知电子邮件包含名称 - Wordpress - New User Notification Email Include Name 在 Woocommerce“新帐户”电子邮件通知模板中获取用户电子邮件 - Get the user email in Woocommerce “New account” email notification template 根据送货方式 ID 在 WooCommerce 新订单电子邮件通知中隐藏送货地址 - Hide shipping address in WooCommerce new order email notification depending on shipping method id WooCommerce 中新订单电子邮件通知的自定义主题 - Custom subject for New Order Email notification in WooCommerce 将回复 email 地址更改为特定 WooCommerce email 通知 - Change reply-to email address to specific WooCommerce email notification 当客户更改地址WooCommerce时发送通知电子邮件 - Send notification email when customer changes address WooCommerce 将WooCommerce处理订单电子邮件通知收件人更改为自定义地址 - Change WooCommerce processing order email notification recipient to a custom address 将自定义用户电子邮件添加到 CC 以获取特定的 Woocommerce 电子邮件通知 - Add custom user email to CC for specific Woocommerce email notification 如何将用户的电子邮件地址添加到Woocommerce电子邮件模板#php? - How to add the user's email address to a Woocommerce email template #php?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM