WP - woocommerce listing product categories by order

admin

Administrator
Staff member
I'm using (wordpress) woocommerce for the first time.

I'm trying to display all the product categories with their respective sub categories in a tree shape, but i cant seems to order them the way i'm ordering them in the back-end using drag and drop.

The WP get_terms() only allows order by id, name, count, slug and none.

The code i'm using is:

Code:
<?php $catTerms = get_terms('product_cat', array('hide_empty' => 0, 'parent' => 0)); ?>
<ul>
<?php foreach($catTerms as $catTerm) : ?>
<li><a href="<?php _e(get_permalink($catTerm->slug)); ?>"><?php _e($catTerm->name); ?></a></li>
<?php endforeach; ?>
</ul>