Check whether an input in bedrijfsparameters has a value

Hi, in a template, I’m adding the name for the ‘wettelijke vertegenwoordiger’ (persoon.custom.represented_by_name). However, when I look at the template ‘bedrijfsparameters’, a name has not always been provided.

As such, I’d like to add a warning in the current template when a ‘wettelijke vertegenwoordiger’ has not been inserted (in the template ‘bedrijfsparameters’).

Now, I first tried with {% if persoon.custom.represented_by_name == ‘’ %} but this doesn’t work; then I tried by assigning persoon.custom.represented_by_name to a variable and then checking whether variable.size == 0, but this gives me an error (Liquid error: undefined method `size’ for nil:NilClass).

How can I best check whether persoon.custom.represented_by_name is empty or not?

Thanks!

Hey,

found it in the Shopify documentation.

solution: {% if persoon.custom.represented_by_name == %}, this works but it sure makes for some extremely ugly coding imho.

What happens if you put false (without quotes) behind it?