Adding subcategories under categories in woocommerce

I am using woocommerce plugin for developing an ecommerce website. Everything working on fine with this plugin. But when it comes to the category and sub-category it makes little bit problem. Actually I want that under category there will be the list of sub-category. But in woocommerce only the category are comming in a list. So can someone tell me how to do this? Any help and suggestions are highly appreciable. Thanks.

Related posts

Leave a Reply

1 comment

  1. Do you have items in the subcategories?

    See my code below which displays a list of Product Categories each linked to their category archive. The important bit is ‘hide_empty-0’ which tells WordPress to display empty categories

    <?php $tax_terms = get_terms('product_cat', 'hide_empty=0' ); ?>
    <ul>
      <?php foreach ($tax_terms as $tax_term) {
        echo '<li>' . '<a href="' . esc_attr(get_term_link($tax_term, $taxonomy)) . '" title="' . sprintf( __( "%s" ), $tax_term->name ) . '" ' . '>' . $tax_term->name.'</a></li>';
    

    } ?>