Have tried your code and it works fine and infact it also gives out the details of each product in the orders. The code which i tried
$filters = array(
'post_status' => 'any',
'post_type' => 'shop_order',
'posts_per_page' => 200,
'paged' => 1,
'orderby' => 'modified',
'order' => 'ASC'
);
$loop = new WP_Query($filters);
while ($loop->have_posts()) {
$loop->the_post();
$order = new WC_Order($loop->post->ID);
foreach ($order->get_items() as $key => $lineItem) {
//uncomment the following to see the full data
// echo '<pre>';
// print_r($lineItem);
// echo '</pre>';
echo '<br>' . 'Product Name : ' . $lineItem['name'] . '<br>';
echo 'Product ID : ' . $lineItem['product_id'] . '<br>';
if ($lineItem['variation_id']) {
echo 'Product Type : Variable Product' . '<br>';
} else {
echo 'Product Type : Simple Product' . '<br>';
}
}
}
And the output i got from the same.
Try this and let me know how it works for you