[英]Edit customer details in Woocommerce email notifications
WooCommerce在哪里包含来自第三方插件的自定义字段? 我想编辑显示所有字段的顺序。
在admin-new-order.php中,我可以通过在Woocommerce_email_customer_details
上方放置Woocommerce_email_customer_details
钩子来执行此woocommerce_email_order_meta
。
只有我才能用我的客户收到的电子邮件将其存档?
根据此问题/答案中的数据,可以使用以下挂钩函数来完成此操作,该函数可让您编辑帐单格式的地址数据:
add_filter( 'woocommerce_order_formatted_billing_address', 'custom_email_formatted_billing_address', 10, 2 );
function custom_email_formatted_billing_address( $billing_address, $order ){
// Get your custom field
$real_first_name = get_post_meta( $order->get_id(), '_billing_voornaam_1_24', true );
// Insert the custom field value in the billing first name
if( ! empty( $real_first_name ) )
$billing_address['first_name'] .= ' ' . $real_first_name;
// Hiding Last name
unset($billing_address['last_name']);
return $billing_address;
}
代码进入活动子主题(或活动主题)的function.php文件中。
经过测试和工作。
对于运送客户的详细信息,您将以相同的方式使用
woocommerce_order_formatted_shipping_address
筛选器挂钩…
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.