---
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
api_name: liquid
---

# Unused​Assign

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 %}
<span>Hello!</span>
{% 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).

***
