Adding customer name to woocommerce order notification email (5 posts)

  1. jusgriff
    Posted 2 years ago #

    I've been researching this for awhile Is there an extensive list of woocommerce order replacement codes we can use in the email templates to pull in customer name.

    From the templates I’ve been able to figure out that %o pulls in the order id and %s pulls in the blog name. Is there one for first name and last name etc, this would really be good to personalise the emails sent to customers a bit more.


  2. Strategic1dentity
    Posted 2 years ago #

    jusgriff, did you find a solution to this?

  3. Cylis Vaidya
    Posted 1 year ago #

    I was searching for a solution but didn't find any online. But eventually found a workable solution in one of the email templates that already has the customer name.

    It is in New Order email for admin (admin-new-order.php). It has a nice snippet which says "You have received an order from %s"

    So, just copy that line of code to whichever email template you want to use it and of course change the text to something else

    <p><?php printf( __( 'You have received an order from %s. Their order is as follows:', 'woocommerce' ), $order->billing_first_name . ' ' . $order->billing_last_name ); ?></p>

    Make sure you copy the email template from
    before you edit so that new Woocommerce version won't overwrite your changes.

  4. uogecko
    Posted 1 year ago #

    Thanks Cylis Vaidya!

  5. jusgriff
    Posted 1 year ago #

    Thanks, Cylis Vaidya, I will try out this code soon to see how it works!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic