default
{{ product.selected_variant.url | default: product.url }}
{{ product.selected_variant.url | default: product.url }}
{
"product": {
"selected_variant": null,
"url": "/products/health-potion"
}
}
Output
/products/health-potion
Anchor to allow_false
allow_false
variable | default: variable, allow_false: boolean
By default, the default
filter's value will be used in place of false
values. You can use the parameter to allow variables to return
false
instead of the default value.
{%- assign display_price = false -%}
{{ display_price | default: true, allow_false: true }}
{%- assign display_price = false -%}
{{ display_price | default: true, allow_false: true }}
Output
false
Was this page helpful?