title: WooCommerce order and WooCommerce Custom Fields plugin plus Events Tickets Plus
body: <p>I am trying to add the data from the Woocommerce Custom Fields plugin to an excel spreadsheet that is exported via the Events Tickets Plus plugin by Tribe. </p>
  
  <p>So far, using the following code, I have managed to add columns to the spreadsheet that not only add the first name and last name columns to the spreadsheet but also bring over the value of the columns from the order.  <br>
  I have also managed to add the columns for relationship_to_child and emergency_medical but, I am stuck when it comes to adding the data from the rightpress plugin.  I tried adding a "get" to the beginning of the custom fields but this did not work. </p>
  
  <p>According to rightpress the Checkout fields are as follows:</p>
  
  <pre><code>                               |    Meta Value         |    Location
  — — — — — — — — — — — — — — — —|— — — — — — — — — — — —|— — — — — — — — — — — — — — — — — — 
                                 |                       |
      _wccf_cf_{key}             |    field value        |    in order meta
                                 |                       |
      _wccf_cf_id_{key}          |    field id           |    in order meta
                                 |                       |
      _wccf_cf_data_{key}        |    extra data array   |    in order meta
                                 |                       |
      _wccf_file_{access_key}    |    file data          |    in order meta
                                 |                       |
  </code></pre>
  
  <p><strong>Here is the code</strong></p>
  
  <pre><code>add_action( 'tribe_events_tickets_generate_filtered_attendees_list', 'tribe_export_custom_set_up' );
  function tribe_export_custom_set_up ( $event_id ) {
      //Add Handler for Community Tickets to Prevent Notices in Exports
  
      if ( ! is_admin() ) {
          $screen_base = 'tribe_events_page_tickets-attendees';
  
      } else {
          $screen      = get_current_screen();
          $screen_base = $screen-&gt;base;
      }
      $filter_name = "manage_{$screen_base}_columns";
  
      add_filter( $filter_name, 'tribe_export_custom_add_columns', 100, 1 );
      add_filter( 'tribe_events_tickets_attendees_table_column', 'tribe_export_custom_populate_columns', 10, 3 );
  }
  
  function tribe_export_custom_add_columns ( $columns ) {
      $columns['wc_first_name'] = 'First Name';
      $columns['wc_last_name'] = 'Last Name';
      $columns['wc_emergency_medical'] = 'Consent Emergency Medical'; // array key changed
      $columns['wc_relationship_to_child'] = 'Relationship to Child'; // array key changed
      $columns['wc_consent_marketing'] = 'Consent to Marketing'; // array key changed
  
      return $columns;
  }
  
  
  
  function tribe_export_custom_populate_columns ( $value, $item, $column ){
  
      $order_id = $item["order_id"]; // tested and works
  
      $firstname = get_post_meta( $order_id, '_billing_first_name', true );
      $lastname = get_post_meta( $order_id, '_billing_last_name', true );
      $emergencymedical = get_post_meta( $order_id, '_wccf_cf_emergency_medical', true );
      $relationshiptochild = get_post_meta( $order_id, '_wccf_cf_relationship_to_child', true );
      $consentmarketing = get_post_meta( $order_id, '_wccf_cf_consent_marketing', true );
  
  
      if ( ! empty( $order_id ) || $order_id &gt; 0 )
      {
          if ( $column == 'wc_first_name') {
              $value = $firstname;
          } elseif ( $column == 'wc_last_name') {
              $value = $lastname;
          } elseif ( $column == 'wc_emergency_medical') {
              $value = $emergencymedical;
          } elseif ( $column == 'wc_relationship_to_child') {
              $value = $relationshiptochild;
          } elseif ( $column == 'wc_consent_marketing') {
              $value = $consentmarketing;
          }
      } else {
          if ( $column == 'wc_first_name') {
              $value = 'test 1';
          } elseif ( $column == 'wc_last_name') {
              $value = 'test 2';
          } elseif ( $column == 'wc_emergency_medical') {
              $value = 'test 3';
          } elseif ( $column == 'wc_relationship_to_child') {
              $value = 'test 4';
          } elseif ( $column == 'wc_consent_marketing') {
              $value = 'test 5';
          }
      }
      if (is_array($value)) $value = join(', ', $value);
      return $value;
  }
  </code></pre>
  
  <p>Is anyone able to help me?</p>