To get this to work for the Collapsible rows you need to Edit main-product.liquid and put the condition inside ‘collapsible_tab’ case like so.
Follow this steps to hide the empty collapsible_tab
Step 1: Login into Shopify admin
Step 2: Go to Online store > Themes
Step 3: Then after click on Action > Edit code
Step 4: Search the main-product.liquid file in Sections
Step 5: Search the collapsible_tab section in liquid file
Then put this condition as per below image.
{%- if block.settings.content != blank or block.settings.page.content != blank -%}
…
{%- endif -%}