Hiding a metafield on product page using conditional liquid

Hi,

Hope someone can help with this.

On our product pages I have a specification section which displays metafields, but should only show them if they contain information.

This is working fine for around 100 of the metafields, apart from 1 (size) which displays both when blank or if the metafield contains data (and it does display the data correctly when present).

The code for the size field is below:

{% if product.metafields.filters.size %}

Size {{product.metafields.filters.size.value}} {% endif %}

I have tried variants to the if logic including:

{% if product.metafields.filters.size != blank -%}

{%- if product.metafields.filters.size == true -%}

Neither of these works and the code is the same (I think) for all of the other metafields in the section.

Example URL (you need to expand the “Specification” tab) - https://bathlab.co.uk/products/origins-living-turner-open-toilet-roll-holder-black

I have tried clearing the metafield data on the product, including adding data and removing it again. That doesn’t work either (it shows the data entered and then returns blank again when nothing).

I have checked the metafield construction against others and cannot see any differences.

If I look at the HTML output on the front end, it seems to be blank:

Size

Can anyone suggest a fix to stop it showing if blank please?

Let me know if any further information / detail is required.

Hopefully it’s something simple I am missing as I’ve spent nearly all day trying to work it out!

Thanks,
Greg