Hiding Subcollections Craft theme

Could anyone give me the coding needed to hide subcollections on Craft theme when they’re empty? Also where I would need to place that code?

Any help would greatly appreciated.

Thank you!

Hi,

That would be great! Once I add the twig code to template files, will this automatically update subcollections to hide if empty?

Thank you!

Could you let me know what I need to do to make this happen?

If you could respond with a solution that would be great.