Display products in hierarchy using php

<pre>
 taxonomy_terms_hierarhically_output(0, 'product_category');
 function taxonomy_terms_hierarhically_output($parent_id, $taxonomy)
 {
       $termId = isset($_GET['cat'])?$_GET['cat']:0;
       $args = array(
               'parent' =&gt; $parent_id,
               'hide_empty' =&gt; false
       );
       $child_terms = get_terms($taxonomy, $args);
       foreach ($child_terms as $child_term)
       { 
         $child_term->name;
         taxonomy_terms_hierarhically_output($child_term->term_id, $taxonomy); 
       }
}
</pre>

Leave a Reply