I managed to display TM options in the csv export by using the following code. But be warned that i only made it compatible with v2.1.6 / Woocommerce 2.6.14. This may require some adaptations for WC 3 :
/************************************/
/* Export des options des commandes */
/************************************/
// Hooks
function rdm_hook() {
add_filter( 'wpg_order_columns', 'rdm_columns' );
add_filter( 'wpg_export_options_settings', 'rdm_columns_settings' );
}
add_action( 'init', 'rdm_hook', 9 );
// Add column to check for options
function rdm_columns( $columns ) {
$columns['wc_settings_tab_order_options'] = 'Options';
return $columns;
}
// Add column in CSV
function rdm_columns_settings( $settings ) {
update_option( 'wc_settings_tab_order_options', 'yes');
$settings['options'] = array(
'name' => 'Options',
'type' => 'checkbox',
'desc' => 'Order Options',
'id' => 'wc_settings_tab_order_options'
);
return $settings;
}
// Add options values in CSV
add_action('wpg_add_values_to_csv', 'rdm_add_values_to_csv');
function rdm_add_values_to_csv( &$csv ) {
$order_id = $csv[0];
$order = new WC_Order( $order_id );
$items = $order->get_items();
$result = "-";
foreach ( $items as $item_id => $item ){
$item_meta = function_exists('wc_get_order_item_meta')?wc_get_order_item_meta( $item_id, '',false ):$order->get_item_meta( $item_id );
$has_epo = is_array($item_meta) && isset($item_meta['_tmcartepo_data']) && isset($item_meta['_tmcartepo_data'][0]);
if ($has_epo){
$epos = maybe_unserialize($item_meta['_tmcartepo_data'][0]);
if (is_array($epos)){
$result = "";
foreach ($epos as $epo) {
$result .= $epo['name'] . " : " . $epo['value'] . "\n";
}
}
}
}
// Decoding HTML
$result = preg_replace_callback("/(&#[0-9]+;)/", function($m) { return mb_convert_encoding($m[1], "UTF-8", "HTML-ENTITIES"); }, $result);
array_push($csv, '"'.$result.'"');
}