Skip to main content

default

variable | default: variable

Sets a default value for any variable whose value is one of the following:

{{ product.selected_variant.url | default: product.url }}

Output

/products/health-potion
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 allow_false parameter to allow variables to return false instead of the default value.

{%- assign display_price = false -%}

{{ display_price | default: true, allow_false: true }}

Output

false
Was this page helpful?