I am overriding the WooCommerce archive-product.php in a child theme so I can list single products and grouped products. The loop outputs each product as a single item which is what I want for Simple Products, but not for Grouped Products as the resulting outputs the parent product in a single item, and the child product in a different single item, what I am trying to do is to output the children of a grouped product under the parent only, not as a single item.
I already searched inside WooCommerce Functions but couldn't find any clue on how to fetch the children of a grouped product for each parent.
<?php
if ( woocommerce_product_loop() ) {
do_action( 'woocommerce_before_shop_loop' );
woocommerce_product_loop_start();
if ( wc_get_loop_prop( 'total' ) ) {
while ( have_posts() ) {
the_post();
do_action( 'woocommerce_shop_loop' );
?>
<div class="list-product-item">
<?php woocommerce_template_loop_product_title(); ?>
</div>
<?php
}
}
woocommerce_product_loop_end();
do_action( 'woocommerce_after_shop_loop' );
?>