To show main categories before product listing please go to General Catalog Settings and find the Main listing shows setting.
You can select Products, Products & Main Categories or Main Categories.
Display Only Products
Select the ‘Products’ option to make only products visible on the main listing. Even if you have any categories they won’t be displayed on the listing.
You can use [show_categories] shortcode to display the categories elsewhere.
Display Main Categories and Products
With the ‘Products & Main Categories’ option selected the top level categories will be displayed on the top of the main catalog page. Products will be also displayed on the bottom of the page.
Click on a category (if there are any categories) to see the category page which will also display subcategories (if there are any) so the user can navigate through the catalog structure.
The products will be displayed on the category page, however this actually depends on the ‘Category Page shows’ setting.
Display only Main Categories on main catalog listing page
Select the Main Categories option to make only top level categories visible on the main catalog page.
Use it in conjunction with the ‘Category Page shows’ setting to manage what the user will see on category pages.