Conditional liquid code not working

Hi all!

I have a simple if condition that if a metafield has a page select it shows a chat size link. This works fine.

Then I added a condition to do the same for another metafield and suddenly it show both duplicated.

Example of page with duplicated links: https://venga-store.com/products/champagne-metallic-sequin-dress

And in this other case, only the Chart Size page is set and the page displays both links: https://venga-store.com/collections/mens-festival-outfits/products/leather-vest-t-shirt

{%- when 'popup' -%}
              {% comment %} MGO: Show Chart Table if not empty {% endcomment %}            
              {%- if product.metafields.custom.size_chart != blank -%}
                
                              
                
                  {{- block.settings.text -}}
                
            {%- endif -%}

           {%- when 'popup' -%}
              {% comment %} MGO: Show Non-Refundable if not empty {% endcomment %}            
              {%- if product.metafields.custom._handmade_and_custom_made_to_order != blank -%}
                
                              
                
                  {{- block.settings.text -}}
                
            {%- endif -%}

try with elseif

{%- when 'popup' -%}
              {% comment %} MGO: Show Chart Table if not empty {% endcomment %}            
              {%- if product.metafields.custom.size_chart != blank -%}
                
                              
                
                  {{- block.settings.text -}}
                

             {%- elsif product.metafields.custom._handmade_and_custom_made_to_order != blank -%}
                
                              
                
                  {{- block.settings.text -}}
                
            {%- endif -%}

Hi @zack_dev , thanks a lot for your help!

That fixed the issue with the duplicated text with link but the other corner case still occurs.

Meaning, now for all products for which the first condition is true (Chart Size table) it also displays the Non-Returnable item link even tough the condition is not true.

Honestly I don’t get why it goes inside that condition, the Metafield is empty.

@zack_dev that this one as a example: https://venga-store.com/collections/mens-festival-outfits/products/leather-vest-t-shirt

it can be that the metafield is not blank you can call the metafield seperately to check what is its value .

I printed both values and they are the same, even tough the second one should be empty.

{{ product.metafields.custom.size_chart }}
{{ product.metafields.custom.made_to_order }}

How can this be, one of the value should be empty as I didn’t fill the metafield.

not sure :grin:

try to check the metafields entries if its empty try to fill it and then again remove it or make a new metafield entry to test.