在确认电子邮件中获取客户姓名 [英] Get customers name in confirmation email

查看:29
本文介绍了在确认电子邮件中获取客户姓名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在与 Woocommerce 合作,我即将发送订单确认电子邮件.

I am working with Woocommerce and I am about to make the order confirmation email.

它想让邮件说:

嗨[客户姓名]"

如何让 Woocommerce 打印客户姓名?

How do you get Woocommerce to print the customers name?

推荐答案

您需要订单对象,因此根据您使用的钩子,它应该在那里.尝试这样的事情:

You need the order object, so depending on what hook you are using it should be there. Try something like this:

add_action('woocommerce_order_status_completed','my_woo_email');
function my_woo_email($order_id){

           $order = new WC_Order( $order_id );
           $to = $order->billing_email;
           $subject = 'this is my subject';
           $message = 'Hi '.$order->billing_first_name.' '.$order->billing_email;$order->billing_last_name.', thanks for the order!';

                woocommerce_mail( $to, $subject, $message, $headers = "Content-Type: text/htmlrn", $attachments = "" )

}

这是未经测试的,但应该可以帮助您入门

This is untested but should get you started

这篇关于在确认电子邮件中获取客户姓名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆