How do I display a product details page tab only in specific categories?

I have 2 main categories in an e-shop, wholesale & retail and under each of them I have appended various subcategories.

I’ve also created a new tab called “Packaging” in the product details page to display wholesale packaging options and I need to display it only in the categories under “Wholesale”. I can set the tab visibility manually for each category but I’d like to do it programmatically, so that each time I add new categories under Wholesale, the tab will appear automatically.

Any suggestions?