• Hi, i’ve look for display by list, the sub-category of 3 catégory parent.
    I find this code in this forum which works well…only one point : it’s display only one of the sub-category and not ALL the sub-category,
    anyone have a idea ?

    <?php
    global $post;
    $sou_cat = get_term_by('slug', 'PARENT-CAT-SLUG', 'product_cat');
    
    $terms = get_the_terms($post->ID, 'product_cat');
    foreach ($terms as $term) {
        if($term->parent === $sou_cat->term_id) { ?>
           <span class="product-sub-cats"><?php echo $term->name; ?></span>
          <?php  break;
        }
    }
     ?>

    thanks a lot !

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Display ALL the child category of a specific parent category in single product’ is closed to new replies.