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

# addSellerShippingMethodToCartWorkflow

> Add shipping methods to a cart, replacing only the same seller's existing methods.

Seller-aware variant of Medusa's `addShippingMethodToCartWorkflow`. Validates the requested options against the cart and their calculated prices, then swaps shipping methods per seller: existing methods belonging to the sellers whose options are being added are removed, while other sellers' methods stay untouched — so a multi-seller cart keeps one shipping method per seller. Refreshes cart items afterwards and emits `cart.updated`. Triggered by `POST /store/carts/:id/shipping-methods`.

## Usage

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

await addSellerShippingMethodToCartWorkflow(container).run({
  input: {
    cart_id: "cart_123",
    options: [{ id: "so_123" }],
  },
})
```

## Input

<ParamField body="cart_id" type="string" required>The cart to add shipping methods to.</ParamField>

<ParamField body="options" type="object[]" required>
  Shipping options to add as methods.

  <Expandable title="properties">
    <ParamField body="id" type="string" required>The shipping option ID; must have a calculated price for the cart.</ParamField>
    <ParamField body="data" type="object">Custom method data validated by the fulfillment provider.</ParamField>
  </Expandable>
</ParamField>

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

## Result

<ResponseField name="result" type="void">No return value; the cart's shipping methods are replaced per seller as a side effect.</ResponseField>

## Hooks

* `validate` — runs after the cart is loaded with `{ input, cart }`.

```ts theme={null}
addSellerShippingMethodToCartWorkflow.hooks.validate(async ({ input, cart }) => {
  // throw to reject the shipping method
})
```
