UndefinedObject
Last edit: Apr 01, 2026
UndefinedObject
Severity: warning | Type: LiquidHtml
This check ensures that no undefined variables are used in your Liquid templates. It prevents errors caused by referencing variables that have not been assigned or passed as arguments, and also reports missing or unused attributes in {% render %}, {% function %}, and {% background %} tags.
The check is aware of:
- Variables defined with
{% assign %},{% capture %},{% parse_json %},{% function %},{% graphql %} - Loop variables from
{% for %}and{% tablerow %} - Global platformOS objects (e.g.
context,current_user) - Arguments passed via
{% render %}and{% function %}tags
Variables starting with _ (underscore) are treated as intentionally unused and do not trigger this check.
Examples
✗ Incorrect Code Example (Avoid using this):
{% if greeting == "Hello" %}
Hello
{% endif %}
greeting has never been defined.
✓ Correct Code Example (Use this instead):
{% assign greeting = "Hello" %}
{% if greeting == "Hello" %}
Hello
{% endif %}
For optional parameters in partials, provide a default:
{% assign my_arg = my_arg | default: nil %}
Configuration
The default configuration for this check:
UndefinedObject:
enabled: true
severity: warning
Disabling This Check
Disabling this check is not recommended.