[英]Set shipping information values to customer order email in woocommerce
We are using a custom payment gateway where the shipping and address information are provided by the payment gateway.我们正在使用自定义支付网关,其中的送货和地址信息由支付网关提供。 Because this information are available through payment gateway we have removed the customer details form from the woocommerce checkout page.
由于此信息可通过支付网关获得,因此我们已从 woocommerce 结帐页面中删除了客户详细信息表单。
The payment gateway we are using is custom gateway.我们使用的支付网关是自定义网关。
Through gateway, customer doesn't have to fill in all information in checkout page, instead they can fill in all information in the mobile, and once they confirm the order, the informatin they have registered sent to woocommerce listener.通过网关,客户不必在结帐页面填写所有信息,而是可以在手机中填写所有信息,一旦确认订单,他们注册的信息就会发送给woocommerce listener。 So we are getting shipping info and billing information from gateway.
所以我们从网关获取运输信息和账单信息。
Now the problem is, when the order succeed, we are not getting the billing details and shipping detalis in cutomer order email or admin order email.现在的问题是,当订单成功时,我们没有在客户订单电子邮件或管理员订单电子邮件中收到账单详细信息和运输详细信息。
The question is, how can I set those information from the gateway to woo-commerce using code, so that the information can be populated in the email.问题是,如何使用代码将这些信息从网关设置为 woo-commerce,以便可以在电子邮件中填充这些信息。
thanks谢谢
From my tutorial on customizing checkout fields this is an example of how you'd add data to emails:从我关于自定义结帐字段的教程中,这是一个如何向电子邮件添加数据的示例:
function kia_display_email_order_meta( $order, $sent_to_admin, $plain_text ) {
$some_field = get_post_meta( $order->id, '_some_field', true ),
$another_field = get_post_meta( $order->id, '_another_field', true ),
if( $plain_text ){
echo 'The value for some field is ' . $some_field . ' while the value of another field is ' . $another_field;
} else {
echo '<p>The value for <strong>some field</strong> is ' . $some_field. ' while the value of <strong>another field</strong> is ' . $another_field;</p>;
}
}
add_action('woocommerce_email_customer_details', 'kia_display_email_order_meta', 30, 3 );
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.