--- title: UnusedAssign description: Identifies variable definitions that aren't used. source_url: html: >- https://shopify.dev/docs/storefronts/themes/tools/theme-check/checks/unused-assign md: >- https://shopify.dev/docs/storefronts/themes/tools/theme-check/checks/unused-assign.md --- ExpandOn this page * [Examples](https://shopify.dev/docs/storefronts/themes/tools/theme-check/checks/unused-assign.md#examples) * [Options](https://shopify.dev/docs/storefronts/themes/tools/theme-check/checks/unused-assign.md#options) * [Disabling this check](https://shopify.dev/docs/storefronts/themes/tools/theme-check/checks/unused-assign.md#disabling-this-check) # UnusedAssign Identifies variable definitions that aren't used. *** ## Examples The following examples contain code snippets that either fail or pass this check. ### ✗ Fail ```liquid {% assign this_variable_is_not_used = 1 %} ``` ### ✓ Pass ```liquid {% assign this_variable_is_used = 1 %} {% if this_variable_is_used == 1 %} Hello! {% endif %} {% assign _prefixed_ok = 1} ``` *** ## Options ```yaml UnusedAssign: 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 Variables that are known to be unused can be prefixed by a `_` to disable the check. Example: ```liquid {% capture _ %} {% form "cart", cart %} {% assign posted_successfully = cart.posted_successfully? %} {% endform %} {% endcapture %} {% assign _unused = 'some value' %} ``` This check is safe to [disable](https://shopify.dev/docs/storefronts/themes/tools/theme-check/configuration). *** * [Examples](https://shopify.dev/docs/storefronts/themes/tools/theme-check/checks/unused-assign.md#examples) * [Options](https://shopify.dev/docs/storefronts/themes/tools/theme-check/checks/unused-assign.md#options) * [Disabling this check](https://shopify.dev/docs/storefronts/themes/tools/theme-check/checks/unused-assign.md#disabling-this-check)