---
title: BlockIdUsage
description: >-
  Warns against the use of block IDs in conditional statements and case
  statements.
source_url:
  html: >-
    https://shopify.dev/docs/storefronts/themes/tools/theme-check/checks/block-id-usage
  md: >-
    https://shopify.dev/docs/storefronts/themes/tools/theme-check/checks/block-id-usage.md
---

# BlockIdUsage

Warns against the use of [block IDs](https://shopify.dev/docs/storefronts/themes/architecture/blocks/theme-blocks) in conditional statements and case statements.

***

## Examples

The following examples contain code snippets that either fail or pass this check.

### ✗ Fail

In the following example, `block.id` is being used in an `if` statement:

```liquid
{% if block.id == 'my-block-id' %}
  This is a bad idea.
{% endif %}
```

This applies to `if`, `elsif`, and `unless` statements.

### ✗ Fail

In the following example, `block.id` is being used in a `case` statement:

```liquid
{% case block.id %}
{% when 'my-block-id' %}
  This is a bad idea.
{% endcase %}
```

***

## Options

The following example contains the default configuration for this check:

```yaml
BlockIdUsage:
  enabled: true
  severity: warning
```

| Parameter | Description |
| - | - |
| `enabled` | Whether this check is enabled. |
| `severity` | The [severity](https://shopify.dev/docs/storefronts/themes/tools/theme-check/configuration#check-severity) of the check. |

***

## Disabling this check

Disabling this check isn't recommended.

***
