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

# Order groups

> Turn a cart with items from several sellers into per-seller orders under one group the shopper can track.

Use order groups to give the shopper one purchase while each seller gets an order of their own.

A marketplace cart can hold offers from several sellers. At checkout, Mercur creates one child order per seller and wraps them in an order group. The group is the record the shopper sees as “my order”, while each seller fulfills, returns, and refunds their own child order. The group stores almost nothing itself: its seller count and total are summed from the child orders every time you read it.

![The order\_group record og\_01JD8Q1234567 in front, with display\_id 98, its customer and read-only cart link, and computed seller\_count 2 and total 87.00. Behind it, the order\_group\_order link lists the two child orders it sums: 47.00 for ACME and 40.00 for GLOBEX.](https://mintcdn.com/mercur/KNc3NtbZ9cUlitbx/images/figures/order-group-overview-light.svg?fit=max\&auto=format\&n=KNc3NtbZ9cUlitbx\&q=85\&s=30030d1a8dd0129af0c483ba9c3eff5a)

> [!NOTE]
>
> An order group is the `OrderGroup` data model (id prefix `og`). It belongs to the Seller module, not a module of its own, so there is no `ORDER_GROUP` key. Resolve its service with `MercurModules.SELLER`.

## Key features

Order groups cover a multi-seller purchase from checkout to the order history:

* **Split checkout**: `completeCartWithSplitOrdersWorkflow` turns one cart into one order per seller under a single group
* **One group per cart**: completing the same cart twice returns the existing group instead of splitting again
* **Readable reference**: an auto-incrementing `display_id` that shoppers and operators can quote
* **Frozen cart link**: a read-only `cart_id` that points at the completed cart
* **Live totals**: `seller_count` and `total` are computed from the child orders at query time, never stored
* **Derived child statuses**: the read workflows add `payment_status` and `fulfillment_status` to every child order
* **Seller scoping**: the list workflow can trim each group down to one seller’s orders

## How it works

A group comes to life when a cart completes:

1. The shopper completes a cart that holds offers from ACME and GLOBEX.
2. `completeCartWithSplitOrdersWorkflow` groups the line items by `item.offer.seller_id`.
3. It creates one `OrderGroup` and one child `Order` per seller, then links them.
4. It authorizes the cart’s payment and refreshes commission lines for each order.
5. It emits `order.placed` for each child order and `order_group.created` for the group.
6. When you read the group, the Seller module sums its child orders into `seller_count` and `total`.

## Get started

Learn how the group, the split, and the computed totals fit together.

> [card] [The order group](https://docs.mercurjs.com/platform/order-group/concepts/the-order-group.md)
>
> The record over a multi-seller purchase, its `display_id`, and the cart link.

> [card] [Order splitting](https://docs.mercurjs.com/platform/order-group/concepts/order-splitting.md)
>
> How checkout turns one cart into one order per seller.

> [card] [Computed totals](https://docs.mercurjs.com/platform/order-group/concepts/computed-totals.md)
>
> Where `seller_count`, `total`, and child order statuses come from.

## Examples

Build against order groups in your own server code.

> [card] [Retrieve an order group](https://docs.mercurjs.com/platform/order-group/guides/retrieve-an-order-group.md)
>
> Load one group with its child orders and their statuses.

> [card] [List order groups](https://docs.mercurjs.com/platform/order-group/guides/list-order-groups.md)
>
> Filter, page, and scope groups to a seller.

> [card] [Split a cart](https://docs.mercurjs.com/platform/order-group/guides/split-a-cart.md)
>
> Complete a cart into a group and hook into the split.

## Resources

The data model, links, workflows, service methods, and events behind order groups.

> [card] [Data models](https://docs.mercurjs.com/platform/order-group/reference/data-models.md)
>
> The `OrderGroup` model, its fields, and indexes.

> [card] [Links](https://docs.mercurjs.com/platform/order-group/reference/links.md)
>
> How a group connects to its cart, orders, sellers, and offers.

> [card] [Workflows](https://docs.mercurjs.com/platform/order-group/reference/workflows.md)
>
> The checkout split, the read workflows, and their hooks.

> [card] [Service](https://docs.mercurjs.com/platform/order-group/reference/service.md)
>
> Seller module methods for order group records.

> [card] [Events](https://docs.mercurjs.com/platform/order-group/reference/events.md)
>
> The events emitted when a cart splits into a group.


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