I am working with Woocommerce and I am about to make the order confirmation email.
It want the mail to say:
"Hi [customers name]"
How do you get Woocommerce to print the customers name?
An order confirmation email is a transactional email sent to a customer once they've completed a transaction in an online store. As the name suggests, this email contains a buyer's order confirmation details, including what they bought, the purchase total, and the estimated delivery date.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With