Skip to main content
An order group is the record that represents one checkout across several sellers. Sellers can’t share an order, because each one ships, refunds, and gets paid on their own, so Mercur gives every seller a child order and keeps the purchase together in a group. You use the group whenever you need the shopper’s view of a purchase: an order history page, a confirmation email, or an operator’s order list.

The OrderGroup record

The group is the OrderGroup data model in the Seller module, stored in the order_group table with the id prefix og. It holds four stored fields and two computed ones:
packages/core/src/modules/seller/models/order-group.ts
Each field has one job:
  • display_id: an auto-incrementing integer, so people can quote a purchase without the internal id
  • customer_id: the customer who completed the cart, or null when the cart has no customer
  • cart_id: the cart the group was created from
  • seller_count and total: summed from the child orders when you read the group, covered in Computed totals
Checkout creates a group for every completed cart, even when the cart has items from one seller. Every marketplace order therefore has exactly one parent group.
The cart_id field backs a read-only link to Medusa’s Cart module, so you can expand cart.* from a group. Checkout sets completed_at on the cart in the same run that creates the group, and the cart doesn’t change after that. Treat cart_id as a stable pointer to the basket the shopper paid for.
The query loads one group and the cart it came from. Because the link is read-only, you can’t create or dismiss it with link.create: it always follows the cart_id column.

Child orders

A group holds no line items. The items live on the child Order records, one per seller, connected through the order_group_order link table. Each child order is a regular Medusa order with its own items, shipping methods, fulfillments, returns, and refunds:
  • Seller: each child order links to the seller who fulfills it
  • Line items: each order line item links to the offer it was bought from
  • Cart: each child order also links back to the completed cart
The query returns the group with each child order and the seller behind it. To go from an order to its group, query the order_group_order link entity by order_id.