Main menu category tree question

The menu works just fine. Hover over the main category and the sub categories become visible.
Is there any way to only have ‘populated’ sub categories visible.
In other words only display sub categories that have items listed instead of empty sub categories.

On the marketplace there is a similar module

Unfortunately, it is not possible out of the box


You can create your own menu manually and add there only those categories, that are required to be displayed:

Or maybe hide categories with no items ???

The menu with manually set up elements, can be used to solve this task.