How to check if custom variation field is null in twig? I would like to know how to check if a custom variation field has content in a twig template (commerce-product.html.twig with variations injected). I have tried with some filters and conditions but without success. I need to hide some html markup if the field is empty. For example:

{% if product.variation_field_mycustomfield is not empty %}
&lt;div class="mycustomclass"&gt;My custom field: {{ product.variation_field_mycustomfield }}&lt;/div&gt;
{% endif %}  


My products have some variations that users can select from a list. When this select changes, the product information must change, and some variations of the same product could have this field empty or not. 

This question isn't related to only image fields. It's for any kind of field.
just vardump() the product.variation_field_mycustomfield that have an empty field then :
then if it is an array  :


{% if product.variation_field_mycustomfield|length == 0 %}
    &lt;div class="mycustomclass"&gt;My custom field: {{ product.variation_field_mycustomfield }}&lt;/div&gt;
{% endif %} 



otherwise, if it is not an array and it is no empty but it has
default value that is considered as empty:


{% if product.variation_field_mycustomfield == 'the vardump output you get at step1' %}
    &lt;div class="mycustomclass"&gt;My custom field: {{ product.variation_field_mycustomfield }}&lt;/div&gt;
{% endif %}