Retrieve Product category ‘NAME’ by product category ID – WooCommerce?

Use get_term_by:

$id = 42;
if( $term = get_term_by( 'id', $id, 'product_cat' ) ){
    echo $term->name;
}

Leave a Comment