• Resolved yourvirtualtemp

    (@yourvirtualtemp)


    I need to know what to put in the woocommerce email settings for New Customer Order Admin Email to add the customer first and last name to the subject line.

Viewing 3 replies - 1 through 3 (of 3 total)
  • It would be tempting to use: {customer_name}. Sadly this is not supported by the core WooCommerce plugin, but it is available if you use the WooCommerce Follow-ups extension:
    https://docs.woocommerce.com/document/automated-follow-up-emails-docs/email-variables-and-merge-tags/

    Alternatively you could copy the email template to:
    themes/your-child-theme-name/woocommerce/emails/…

    The $order object is passed to the template, so adding the following code to the template should be able to recover the customer’s name from the order:

      $user_id = $order->get_customer_id();
      if( !$user_id ) {
        return; // user_id not found
      }
      $user = get_user_by( 'ID', $user_id );
      if( !$user ) {
        return; // user not found
      }
      $customer_name = $user->first_name.' '.$user->last_name;
        
      // email header
      do_action( 'woocommerce_email_header', $email_heading, $email );
    ?>
    
    // will have to go in the message body - modifying the subject is too complex for here.
    
    <p>Customer name: <?php print $customer_name; ?></p>

    Some php skills will be needed to get it working.

    Thread Starter yourvirtualtemp

    (@yourvirtualtemp)

    So I can’t add any of these to the subject line then? The only way is to buy yet another extension or create a new php page?

    {customer_username} Displays the username of your customer
    {customer_first_name} Displays the first name of your customer
    {customer_last_name} Displays the last name of your customer
    {customer_name} Displays the concatenated first and last name of your customer

    Not with the core plugin.

    Regarding the Woo extension, and I can’t say whether that will allow subject line placeholders as well as message body placeholders. They will take pre-sales questions.

    I found this free plugin:
    https://www.ads-software.com/plugins/woo-custom-emails/
    It has an {order_billing_name} placeholder, amongst others, but it looks like that will only work in the message body and not in the subject line.

    Check out other email plugins at www.ads-software.com/plugins and codecanyon.net. There are a few. Its unlikely anyone will know all of them and you’ll need to just try a few promising ones.

    With php skills or a developer it will be achievable. You can post a job here:
    https://jobs.wordpress.net/

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to add customer name to new customer admin order email’ is closed to new replies.