I am looking to generate xml file for all my products. My current question displays all the product names but how to reach each product category? All of the products have sub-categories and categories.
$args = array(
'post_type' => 'product',
'orderby' => 'post_excerpt',
'order' => 'ASC',
//'product_cat' => 'My Product Category',
'post_status' => 'publish'
);
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) {
$loop->the_post();
echo '' . get_the_title() . '<br /><br />';
}