default
Sets a default value to any variable that is one of the following:
- null
- false
- empty string
Params
value{Any}The input value. This parameter is required.default{Any}The default value. This parameter is required.[hash.allow_false]{Boolean}Allows false values. Optional, defaults to true.[hash.allow_empty_str]{Boolean}Allows empty strings. Optional, defaults to true.result{Any}
Usage
{{default value default [allow_false=false] [allow_empty_str=false] }}
Example
{{ default product.selected_variant.url product.url }}
allow_false
By default, the default helper will replace false values. The allow_false parameter allows the variable to return false instead of its default value.
{{ assign 'display_price' false }}
{{ default display_price true allow_false=true }}
Was this article helpful to you?