The code snippet below will create a list of woocommerce product categories with sub-categories as child list elements below.
You can style the output by using the class selector “wc-product-categories-list”.
You can also get rid of sub categories by getting rid of the sub categories section or by simply deleting line 56.