Skip to main content
In this guide, you’ll learn how to list order groups from server code, page through the results, and optionally scope them to a single seller. Mercur exposes a getOrderGroupsListWorkflow that returns groups with their aggregated child orders and a total count for pagination.

Run the workflow

src/api/custom/order-groups/route.ts
The workflow returns { rows, metadata }, where metadata carries the count, skip, and take you need to drive pagination.
Filters go inside variables: the group repository understands id, customer_id, seller_id, status, sales_channel_id, created_at, updated_at, and a free-text q (matched against group id and customer id).

Scope to a seller

Pass a sellerId to get a vendor’s slice. The workflow filters each group’s child orders down to that seller, so vendors only ever see their own orders within a group.
Admin surfaces call this workflow with no sellerId for platform-wide visibility. Vendor surfaces pass the resolved seller so both the query and the returned child orders stay scoped to that store.