Title: Salutation inside E-Mails
Last modified: October 20, 2020

---

# Salutation inside E-Mails

 *  Resolved [milo1988](https://wordpress.org/support/users/milo1988/)
 * (@milo1988)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/salutation-inside-e-mails/)
 * I’m not that familiar with php, so hopefully you could help me out. Your plugin
   is working great in our checkout area, but i won’t show the salutation inside
   the order E-Mails. We’re using storefront as the theme and checkoutwc for the
   checkout.
 * The PHP Snippet wich is inside customer-on-hold-order.php is
 * `<p><?php printf( esc_html__( ' {salutation} Hi %s,', 'woocommerce' ), esc_html(
   $order->get_billing_first_name() ) ); ?></p>`
 * But i won’t show the salutation. What exactly is am i doing wrong? Our goal is
   it to show it like this “Sehr geehrte Frau Nadine Muster”. Hope you could help
   me out
    -  This topic was modified 5 years, 8 months ago by [milo1988](https://wordpress.org/support/users/milo1988/).

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [FAKTOR VIER](https://wordpress.org/support/users/faktorvier/)
 * (@faktorvier)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/salutation-inside-e-mails/#post-13557816)
 * Hi [@milo1988](https://wordpress.org/support/users/milo1988/)
 * The following snippet should output the salutation like your desired goal:
 *     ```
       <p>
         <?php
           $salutation = get_post_meta($order->get_id(), '_billing_salutation', true);
   
           printf(
             '%s %s',
             $salutation === 'mr' ? 'Sehr geehrter Herr' : 'Sehr geehrte Frau',
             esc_html( $order->get_formatted_billing_full_name()),
           );
         ?>
       </p>
       ```
   
 * The snippet is not tested. If there’s an error or its not working at all, feel
   free to contact us again!
 *  Thread Starter [milo1988](https://wordpress.org/support/users/milo1988/)
 * (@milo1988)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/salutation-inside-e-mails/#post-13557880)
 * Thank you so much. Exactly what i was looking for
 *  [WebCodePoet](https://wordpress.org/support/users/senjoralfonso/)
 * (@senjoralfonso)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/salutation-inside-e-mails/#post-14013671)
 * Hi, in the standard e-mails there is just
 * <p><?php printf( esc_html__( ‘Hi %s,’, ‘woocommerce’ ), esc_html( $user_login));?
   ></p>
 * without the order-id, is it also possible to use the salutation there?
 *  Plugin Author [FAKTOR VIER](https://wordpress.org/support/users/faktorvier/)
 * (@faktorvier)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/salutation-inside-e-mails/#post-14018271)
 * Hi [@senjoralfonso](https://wordpress.org/support/users/senjoralfonso/)
 * This should work:
 *     ```
       <p>
       	<?php
       		$salutation = get_user_meta($user_id, 'billing_salutation', true);
   
       		if(!empty($salutation)) {
       			$salutation_label =  \F4\WCSF\Core\Hooks::get_option_label($salutation); 
   
       			printf( esc_html__( ‘Hi %s,’, ‘woocommerce’ ), esc_html( "{$salutation_label} {$user_login}" ) );
       		} else {
       			printf( esc_html__( ‘Hi %s,’, ‘woocommerce’ ), esc_html( $user_login ) );
       		}
       	?>
       </p>
       ```
   
 * Let me know if its not working or not what you’ve expected.
 *  [WebCodePoet](https://wordpress.org/support/users/senjoralfonso/)
 * (@senjoralfonso)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/salutation-inside-e-mails/#post-14046216)
 * With your code as help, I wrote this, which is working for me:
 *  `<?php
    $salutation = get_user_meta($user_id, ‘billing_salutation’, true);
 *  printf(
    ‘%s %s’, $salutation === ‘mr’ ? ‘Sehr geehrter Herr’ : ‘Sehr geehrte
   Frau’, esc_html( $user_login ), ); ?>`

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Salutation inside E-Mails’ is closed to new replies.

 * ![](https://ps.w.org/f4-woocommerce-salutation-fields/assets/icon-256x256.jpg?
   rev=1985795)
 * [F4 Salutation Fields for WooCommerce](https://wordpress.org/plugins/f4-woocommerce-salutation-fields/)
 * [Support Threads](https://wordpress.org/support/plugin/f4-woocommerce-salutation-fields/)
 * [Active Topics](https://wordpress.org/support/plugin/f4-woocommerce-salutation-fields/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/f4-woocommerce-salutation-fields/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/f4-woocommerce-salutation-fields/reviews/)

 * 5 replies
 * 3 participants
 * Last reply from: [WebCodePoet](https://wordpress.org/support/users/senjoralfonso/)
 * Last activity: [5 years, 4 months ago](https://wordpress.org/support/topic/salutation-inside-e-mails/#post-14046216)
 * Status: resolved