title: Send a custom email with additional account fields values on save in Woocommerce 3
body: <p>On the basis of the plugin “Advanced Custom Fields” additional fields were created for the personal account of WooCommerce users. Using the second "ACF for WooCommerce" plugin, I placed these fields on the edit-account page.</p>
  
  <p>If the user has filled in the fields or edited them, the administrator will receive an email with the values of these fields. The following code is responsible for notifications:</p>
  
  <pre><code>if (!class_exists('WooCommerceNotifyChanges')) {
  
      class WooCommerceNotifyChanges {
  
          function __construct() {                        
              add_action('woocommerce_save_account_details', array($this, 'woocommerce_send_notification'), 15, 1);
          }
  
          function woocommerce_send_notification($user_id) {
              $body = '';
              $to = 'info@domain.com'; 
              $subject = 'Edit profile data';
  
              update_meta_cache('user', $user_id); // delete cache   
  
              $user = new WP_User($user_id);
              $user_name = $user-&gt;user_login;
  
              $body .= '&lt;table&gt;';
              $body .= '&lt;tr&gt;&lt;td&gt;'.__("Profile"). '&lt;/td&gt;&lt;/tr&gt;';                        
              $body .= '&lt;tr&gt;&lt;td&gt;Login: &lt;/td&gt;&lt;td&gt;'.$user_name. '&lt;/td&gt;&lt;/tr&gt;';
              $body .= '&lt;tr&gt;&lt;td&gt;First Name: &lt;/td&gt;&lt;td&gt;'.$user-&gt;billing_first_name. '&lt;/td&gt;&lt;/tr&gt;';
              $body .= '&lt;tr&gt;&lt;td&gt;Last Name: &lt;/td&gt;&lt;td&gt;'.$user-&gt;billing_last_name. '&lt;/td&gt;&lt;/tr&gt;';
              $body .= '&lt;tr&gt;&lt;td&gt;Phone: &lt;/td&gt;&lt;td&gt;'.get_user_meta($user_id, 'field_5b4640119354c', $single=true). '&lt;/td&gt;&lt;/tr&gt;'; //text field
              $body .= '&lt;tr&gt;&lt;td&gt;Age: &lt;/td&gt;&lt;td&gt;'.get_user_meta($user_id, 'field_5b462d304b101', $single=true). '&lt;/td&gt;&lt;/tr&gt;'; //text field
              $body .= '&lt;tr&gt;&lt;td&gt;Family: &lt;/td&gt;&lt;td&gt;'.get_user_meta($user_id, 'field_5b4bd7d9f0031', $single=true). '&lt;/td&gt;&lt;/tr&gt;'; // selector                       
              $body .= '&lt;tr&gt;&lt;td&gt;What style do you prefer? &lt;/td&gt;&lt;td&gt;'.get_user_meta($user_id, 'field_5b47917a378ed', $single=true). '&lt;/td&gt;&lt;/tr&gt;'; // checkbox                      
  
              $body .= '&lt;/table&gt;';
  
              //set content type as HTML
              $headers = array('Content-Type: text/html; charset=UTF-8;');
  
              //send email
              if (wp_mail($to, $subject, $body, $headers)) {
                  //echo 'email sent';
              } else {
                  //echo 'email NOT sent';                
              }
              //exit();
          }
      }
      new WooCommerceNotifyChanges();
  }
  </code></pre>
  
  <h3>Here two errors occur:</h3>
  
  <ol>
  <li><p>When a user edits these fields, old, apparently cached data is sent to the administrator email. When you re-send without editing, you will receive the correct field data.<br>
  <br>
  I put a line of code:</p>
  
  <pre><code>update_meta_cache('user', $user_id);
  </code></pre>
  
  <p>But it does not work, the old data is still coming. Apparently, I did something wrong.</p></li>
  <li><p>The data of all fields are correctly stored in the database and also correctly displayed in an email to the administrator. The problem with checkboxes.<br>
  <br>
  In this case, the "What style do you prefer?" three checkboxes "Classic", "Casual" and "Sport" are displayed. The user selected the "Casual" checkbox. The value of this field is correctly stored in the database.<br>
  <br>
  But in the email to the administrator, instead of this value, only the word “Array” comes.</p></li>
  </ol>
  
  <p>Tell me how to fix it?</p>
  
  <p>Any help is appreciated.</p>