archive page
-
hi I am trying to show all products with its child categories in one page
– parent category title – (by category id)
child category name
> product > product > product > product > product > productchild category name
> product > product > product > product > product > productchild category name
> product > product > product > product > product > productwhat i have now kinda works
<?php $parentid = get_queried_object_id(); $args = array( 'parent' => $parentid ); $terms = get_terms( 'product_cat', $args );?> <div class="product-cats-arch"> <?php woocommerce_breadcrumb(); ?> <?php if ( $terms ) { ?> <?php foreach ( $terms as $term ) { ?> <section class="section-cat"> <h2> <?php echo $term->name; ?> </h2> <ul> <?php while ( have_posts() ) : the_post(); ?> <?php wc_get_template_part( 'content', 'product' ); ?> <?php endwhile; ?> </ul> </section> <?php } ?> <?php } ?>
but it shows all the products under each subcategory
i cant figure it out
any help please ?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘archive page’ is closed to new replies.