May 29, 2014

How to get Woocommerce products categories?

How to get Woocommerce products categories?

$current_term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
$category_name = $current_term->name;
$args = array(
'hide_empty' => false,
'orderby' => 'name',
'order' => 'ASC',
'child_of' => 0,
'parent' => (isset($current_term->term_id)?$current_term->term_id:0)
);

$product_categories = get_terms( ‘product_cat’, $args );

Last updated: May 29, 2014