default
{{ product.selected_variant.url | default: product.url }}
Code
{{ product.selected_variant.url | default: product.url }}Data
{
"product": {
"selected_variant": null,
"url": "/products/health-potion"
}
}Output
/products/health-potion
Output
/products/health-potionAnchor 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 }}
Code
{%- assign display_price = false -%}
{{ display_price | default: true, allow_false: true }}Output
false
Output
falseWas this page helpful?