--- title: UndefinedObject description: Identifies references to undefined objects. source_url: html: >- https://shopify.dev/docs/storefronts/themes/tools/theme-check/checks/undefined-object md: >- https://shopify.dev/docs/storefronts/themes/tools/theme-check/checks/undefined-object.md --- ExpandOn this page * [Examples](https://shopify.dev/docs/storefronts/themes/tools/theme-check/checks/undefined-object.md#examples) * [Options](https://shopify.dev/docs/storefronts/themes/tools/theme-check/checks/undefined-object.md#options) * [Disabling this check](https://shopify.dev/docs/storefronts/themes/tools/theme-check/checks/undefined-object.md#disabling-this-check) # UndefinedObject Identifies unknown variable references. Liquid variables must declared using `assign` tags, `capture` tags, or documented with `@param` inside of [LiquidDoc](https://shopify.dev/docs/storefronts/themes/tools/liquid-doc). Some Liquid variables exist by default in a global scope. See Liquid [objects](https://shopify.dev/docs/api/liquid/objects). *** ## Examples The following examples contain code snippets that either fail or pass this check for different scenarios. ### ✓ Pass This check passes when properly calling global Liquid objects. ## blocks/my-block.liquid ```liquid {{ collection }} {{ product }} ``` ### ✗ Fail This check fails when a variable is used in a block before it has been assigned using `assign` or `capture`. This check is skipped for snippet files unless it contains LiquidDoc. See examples below. ## blocks/my-block.liquid ```liquid {{ my_variable }} ``` ### ✓ Pass This check passes when a variable has been assigned in a block before use. ## blocks/my-block.liquid ```liquid {% assign my_variable = "Hello" %} {{ my_variable }} ``` ### ✗ Fail This check fails when a variable is used within a snippet or block file, but is neither defined locally nor documented with `@param` within that file's `{% doc %}` tag. ## snippets/my-snippet.liquid ```liquid {% doc %} @param {string} my_variable - The variable to be used. {% enddoc %} {{ another_variable }} ``` ### ✓ Pass This check passes when a variable used within a snippet or block is documented with `@param`. ## snippets/my-snippet.liquid ```liquid {% doc %} @param {string} my_variable - The variable to be used. {% enddoc %} {{ my_variable }} ``` *** ## Options ```yaml UndefinedObject: enabled: true severity: warning ``` | Parameter | Description | | - | - | | `enabled` | Whether this check is enabled. | | `severity` | The [severity](https://shopify.dev/themes/tools/theme-check/configuration#check-severity) of the check. | *** ## Disabling this check Disabling this check isn't recommended as it helps catch typos and potential runtime errors. *** * [Examples](https://shopify.dev/docs/storefronts/themes/tools/theme-check/checks/undefined-object.md#examples) * [Options](https://shopify.dev/docs/storefronts/themes/tools/theme-check/checks/undefined-object.md#options) * [Disabling this check](https://shopify.dev/docs/storefronts/themes/tools/theme-check/checks/undefined-object.md#disabling-this-check)