assign
Creates a new variable.
You can create variables of any basic type, object, or object property.
Predefined Liquid objects can be overridden by variables with the same name. To make sure that you can access all Liquid objects, make sure that your variable name doesn't match a predefined object's name.
Predefined Liquid objects can be overridden by variables with the same name. To make sure that you can access all Liquid objects, make sure that your variable name doesn't match a predefined object's name.
Caution: Predefined Liquid objects can be overridden by variables with the same name. To make sure that you can access all Liquid objects, make sure that your variable name doesn't match a predefined object's name.
Syntax
The name of the variable being created.
The value you want to assign to the variable.
Code
{%- assign product_title = product.title | upcase -%}
{{ product_title }}Data
{
"product": {
"title": "Health potion"
}
}Output
Output
HEALTH POTION