Display all categories including sub categories under a list ul

Do you know how recursive functions are working? Here is an example:

function get_categories_list( $parent ) {
    $args = array(
        'taxonomy'          => 'product_cat',
        'hide_empty'        => false,
        'parent'            => $parent
    );
    $current_level_categories = get_terms( $args );
    $result="";
    if ( $current_level_categories ) {
        foreach ( $current_level_categories as $cat ) {
            if ( $cat->name == 'Uncategorized' ) continue;
            $term_link = get_term_link( $cat, 'product_cat' );
            $cat_thumb_id = get_woocommerce_term_meta( $cat->term_id, 'thumbnail_id', true );
            $shop_catalog_img_arr = wp_get_attachment_image_src( $cat_thumb_id, 'shop_catalog' );
            $cat_img = $shop_catalog_img_arr[0];
            $result .= '<li><a href="' . $term_link . '">' . $cat->name . '</a>' . get_categories_list( $cat->term_id ) . '</li>';
        }
        $result="<ul class="list-unstyled">" . $result . '</ul>';
    }
    return $result;
}
echo get_categories_list( 0 );

To filter “Uncategorized” category I’d better rely on its slug rather than on its name:

if ( $cat->slug == 'uncategorized' ) continue;