Hi,
To achieve your goal of displaying all the values of the fields from the orders in a column on the WooCommerce orders page, you can use our WCPA plugin along with the following code snippet added to your theme’s functions.php file:
add_filter( 'manage_edit-shop_order_columns', 'wcpa_report_column', 10, 1 );
function wcpa_report_column( $columns ) {
$columns['_adddon_report'] = 'Addon Report';
return $columns;
}
add_action( 'manage_shop_order_posts_custom_column', 'wcpa_report_column_data', 10, 1 );
function wcpa_report_column_data( $column ) {
global $post;
if ( '_adddon_report' === $column ) {
$order_id = $post->ID;
$order = wc_get_order( $order_id );
$types = array( 'line_item');
foreach( $order->get_items( $types ) as $item_id => $item ) {
echo "<p><b>Item:</b> ".$item->get_name()."</p>";
$meta_data = $item->get_formatted_meta_data('');
foreach ( $meta_data as $meta_id => $meta ) {
$field_display_label = wp_kses_post( $meta->display_key );
echo "<li style='list-style:square;'><div style='display:inline-flex;'><p><b>".$field_display_label.":</b> </p>".$meta->display_value."</div></li>";
}
}
}
}
The outcome will be like in the screenshot.
Thanks.