> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mercurjs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Offer events

> Events the offer workflows emit, with their payloads, for subscribers and side effects.

The offer and offer condition workflows emit events after they write. Subscribe to them to reindex search, sync an external system, or start a follow-up workflow instead of polling.

## Offer events

The offer workflows emit one event per affected offer. The names come from `OfferWorkflowEvents`.

| Event | Emitted when | Payload |
| - | - | - |
| `offer.created` | `createOffersWorkflow` creates an offer | `{ id, product_id }` |
| `offer.updated` | `updateOffersWorkflow` updates an offer | `{ id, product_id }` |
| `offer.updated` | `batchOfferInventoryItemsWorkflow` changes an offer’s inventory links | `{ id }` |
| `offer.deleted` | `deleteOffersWorkflow` soft-deletes an offer | `{ id, product_id }` |

> [!NOTE]
>
> `upsertOfferPricesWorkflow` emits no event of its own. When `updateOffersWorkflow` runs it, `offer.updated` covers the change. When you run it directly, use its `offerPricesUpserted` hook.

## Offer condition events

The condition workflows emit one event per condition. The names come from `OfferConditionWorkflowEvents`.

| Event | Emitted when | Payload |
| - | - | - |
| `offer_condition.created` | `createOfferConditionsWorkflow` creates a condition | `{ id }` |
| `offer_condition.updated` | `updateOfferConditionsWorkflow` updates a condition | `{ id }` |
| `offer_condition.deleted` | `deleteOfferConditionsWorkflow` deletes a condition | `{ id }` |

## Subscribe to an offer event

A subscriber receives the payload and the container. This one reads the new offer with its store.

```ts title="src/subscribers/offer-created.ts" theme={null}
import type { SubscriberArgs, SubscriberConfig } from "@medusajs/framework"
import { ContainerRegistrationKeys } from "@medusajs/framework/utils"

export default async function offerCreatedHandler({
  event,
  container,
}: SubscriberArgs<{ id: string; product_id: string }>) {
  const query = container.resolve(ContainerRegistrationKeys.QUERY)
  const { data: [offer] } = await query.graph({
    entity: "offer",
    fields: ["id", "sku", "seller.name"],
    filters: { id: event.data.id },
  })
  container.resolve("logger").info(`${offer.seller.name} listed ${offer.sku}`)
}

export const config: SubscriberConfig = {
  event: "offer.created",
}
```

Payloads carry ids only, so query the offer for the fields you need. For an `offer.deleted` subscriber, read values from the `offersDeleted` hook instead, since the row is already soft-deleted.

## Related

* [Offer workflows](https://docs.mercurjs.com/platform/offer/reference/workflows.md)
* [Offer module links](https://docs.mercurjs.com/platform/offer/reference/links.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.