Skip to main content

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

Output

HEALTH POTION
Was this page helpful?