Checkbox

A checkbox can hold two states - checked or unchecked. The Metafield value of a checked checkbox (!) is represented as a string value of "true" but an unchecked checkbox will cause the underlying Metafield to be deleted rather than contain a value of "false". Accordingly, we can test for it being checked or not this way:

{% if product.metafields.accentuate.washable %}
  <p>{{ product.title }} can be washed</p>
{% else %}
  <p>{{ product.title }} can NOT be washed</p> 
{% endif %}

Last updated