> ## 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.

# createOffersWorkflow

> Create seller offers with inventory items and offer-scoped prices.

Creates one offer per entry: creates and links new inventory items (with optional starting stock levels) to the offer and the seller, ensures the master variant has a `PriceSet`, writes the offer's prices onto that shared set scoped by an `offer_id` price rule, and links the price rows to the offer. Emits `offer.created`. Triggered by `POST /vendor/offers` and the vendor/admin offer batch routes.

## Usage

```ts theme={null}
import { createOffersWorkflow } from "@mercurjs/core/workflows"

const { result } = await createOffersWorkflow(container).run({
  input: {
    offers: [
      {
        seller_id: "sel_123",
        created_by: "member_123",
        variant_id: "variant_123",
        shipping_profile_id: "sp_123",
        sku: "ACME-TEE-M",
        inventory_items: [
          { stock_levels: [{ location_id: "sloc_123", stocked_quantity: 50 }] },
        ],
        prices: [{ amount: 1999, currency_code: "usd" }],
      },
    ],
  },
})
```

## Input

<ParamField body="offers" type="object[]" required>
  Offers to create.

  <Expandable title="properties">
    <ParamField body="seller_id" type="string" required>The seller that owns the offer.</ParamField>
    <ParamField body="created_by" type="string" required>ID of the member creating the offer.</ParamField>
    <ParamField body="sku" type="string" required>The offer's SKU.</ParamField>
    <ParamField body="variant_id" type="string" required>The master product variant the offer sells; fails if not found.</ParamField>
    <ParamField body="shipping_profile_id" type="string" required>Shipping profile used to fulfill the offer.</ParamField>
    <ParamField body="inventory_items" type="object[]" required>New inventory items to create and link; at least one entry. Each entry accepts `sku`, `title`, `required_quantity` (default `1`), and `stock_levels` (`{ location_id, stocked_quantity }[]`).</ParamField>
    <ParamField body="prices" type="object[]" required>Offer price ladder; each row accepts `amount`, `currency_code`, `min_quantity`, `max_quantity`, and `rules`.</ParamField>
    <ParamField body="ean" type="string | null">EAN; snapshotted from the variant when omitted.</ParamField>
    <ParamField body="upc" type="string | null">UPC; snapshotted from the variant when omitted.</ParamField>
    <ParamField body="metadata" type="object | null">Custom key-value data.</ParamField>
  </Expandable>
</ParamField>

<ParamField body="additional_data" type="object">Custom data passed through to the workflow hooks.</ParamField>

## Result

<ResponseField name="result" type="OfferDTO[]">The created offers.</ResponseField>

## Hooks

* `validate` — runs first with `{ input }`.
* `offersCreated` — runs after creation with `{ offers, additional_data }`.

```ts theme={null}
createOffersWorkflow.hooks.offersCreated(async ({ offers, additional_data }) => {
  // react to new offers
})
```
