Skip to main content

assign

Creates a new variable.

You can create variables of any basic type, object, or object property.


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

{% 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 }}

Output

HEALTH POTION
Was this page helpful?