wordpress - Get customers name in Woocommerce -
i working woocommerce , make order confirmation email.
it want mail say:
"hi [customers name]"
how woocommerce print customers name?
thanks in advance!
you need order object, depending on hook using should there. try 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 subject'; $message = 'hi '.$order->billing_first_name.' '.$order->billing_email;$order->billing_last_name.', order!'; woocommerce_mail( $to, $subject, $message, $headers = "content-type: text/htmlrn", $attachments = "" ) }
this untested should started
Comments
Post a Comment