> For the complete documentation index, see [llms.txt](https://learn.mechanic.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://learn.mechanic.dev/platform/events/filters.md).

# Event filters

An **event filter** is a Liquid template that evaluates incoming events before they reach your tasks. If the template's output equals the string "false", the event is skipped—no tasks will run for that [event](/core/events.md). Any other output (including empty output) allows the event to proceed normally.

Event filters have access to `event.topic`, `event.data` (the event payload, after any source-specific processing such as custom Shopify webhook payload customization), and `shop` variables. They're commonly used during bulk operations or data migrations to prevent unnecessary task runs. For example, if you're bulk-updating thousands of customers and have tasks subscribed to `shopify/customers/update`, you can use a filter to skip those update events during the migration period.

{% hint style="warning" %}
Event filters should not be confused with [Liquid filters](/platform/liquid/basics/filters.md).
{% endhint %}

## Configuration

Event filters are configured in an account's Mechanic settings.

An event filter has two parts:

* Name – any descriptive string
* Template – a Liquid template that renders `false` for events that should be ignored

<figure><img src="https://3145272362-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MQrnkixbmVHvKHMwAbm%2Fuploads%2Fgit-blob-79b72b8ca08d1657701042273106953f84744330%2Fmechanic-event-filters.png?alt=media" alt="The Event filters section in Mechanic settings"><figcaption></figcaption></figure>

## Operation

When an event is received, Mechanic begins by running any event filters that are present on a store's Mechanic account. (Order is not guaranteed.) Mechanic renders each event filter template, providing the `event` and `shop` variables. If an event filter's output equals the string "false", Mechanic halts processing of that event entirely—no tasks are run. Any other output (including empty output) allows the event to continue to tasks subscribing to the event's topic.

An event that *wasn't* processed will look something like this, in the Mechanic frontend:

![](https://3145272362-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MQrnkixbmVHvKHMwAbm%2Fuploads%2Fgit-blob-433bff58805f36bf785fba06479297801000e914%2FScreen%20Shot%202022-06-02%20at%204.55.15%20PM.png?alt=media)

This feature is useful if a Mechanic account is experiencing (or will experience) a large volume of events that (a) don't need to be processed at all, (b) would slow down your account if they *were* processed ([learn more about concurrency](/core/runs/concurrency.md)), and (c) can be programmatically identified.

You can add, update, and remove event filters at any time. Any changes go into effect immediately.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://learn.mechanic.dev/platform/events/filters.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
