Before you begin
You need the following:- A completed multi-seller cart: at least one order group in your database, for example from a storefront checkout
- The group id: an id with the
ogprefix, such asog_01JD8Q1234567
Load the group in an API route
1
Create the route
Run The workflow adds the child order fields it needs on top of yours, so
getOrderGroupDetailWorkflow with the group id and the fields you want back.src/api/admin/purchases/[id]/route.ts
order_group.orders is always populated. Each order carries payment_status and fulfillment_status.2
Add the child order fields you display
Ask for extra order fields with the The workflow always returns
orders. prefix.orders.id, orders.status, orders.currency_code, and orders.items.*. Everything else on the order comes from your list.3
Handle a missing group
The workflow throws a
NOT_FOUND error when no group has the id. Inside an API route, Medusa’s error handler turns it into a 404 response, so you don’t need to check the result.Keep payment collections and fulfillments in the response
The workflow loads every child order’s payment collections and fulfillments to compute the statuses, then drops them from the result. To keep them, include a field that containspayment_collections or fulfillments:
payment_collections holds the cart’s shared collection. After capture, it holds the order’s own collection. Fields that start with orders.cart keep the child orders’ cart in the result too.
Follow the cart link
Expand the read-only cart link to get the basket the group came from:Find the group for an order
When you start from a child order id, look up the group through theorder_group_order link entity, then run the workflow with its id:
ContainerRegistrationKeys comes from @medusajs/framework/utils. link is undefined when the order isn’t part of a group.