assign
Creates a new variable.
You can create variables of any basic type, object, or object property.
Syntax
{% assign variable_name = value %}
variable_name
The name of the variable being created.
value
The value you want to assign to the variable.
{%- assign product_title = product.title | upcase -%}
{{ product_title }}
{%- assign product_title = product.title | upcase -%}
{{ product_title }}
{
"product": {
"title": "Health potion"
}
}
Output
HEALTH POTION
Was this page helpful?