How can I hide tabs with no metadata in Dawn theme?

Hi,

Can someone help me hide the tabs when I have no metadata filled in them in Dawn theme. I have done it before with this theme, but they’ve done a lot of updates since I last used it and now that code doesn’t work anymore.

Thanks.

@shellbell

You’ll need to wrap your tabs with a conditional to check whether it’s empty. Something like this:

{% assign test = product.metafields.custom.test %}

{% if test != blank and test != "" %}

The metafield is not empty

{% endif %}

Kind regards,
Diego

I just want any of the tabs that I use on the product to be able to hide when metafields aren’t filled out. I previously used a few different methods depending on theme, but none are working on the Dawn theme

Yes I have tried a few methods of this but it’s not seeming to work on the Dawn theme

For anyone wondering I managed to solve it using this

{%- if block.settings.content != blank -%} in main.product

can I please ask where you put this code? Thanks

Yes under sections go to main.product. Not sure if this is the exact line as I edited other code and can’t remember but around line 251 there is

{%- when ‘collapsible_tab’ -%}

{% render 'icon-accordion', icon: block.settings.icon %}

{{ block.settings.heading | default: block.settings.page.title }}

and I inserted it after the {%- when ‘collapsible_tab’ -%} to be

{%- when ‘collapsible_tab’ -%}
{%- if block.settings.content != blank -%}

{% render 'icon-accordion', icon: block.settings.icon %}

{{ block.settings.heading | default: block.settings.page.title }}