Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

912 B
Raw Blame
/**
 * Search params that open the orders list showing one purchase's orders.
 *
 * A basket spanning several sellers becomes several orders, and the thing an
 * operator wants from any one of them is the rest — so both the orders table
 * and the order page link here rather than each spelling the filter out.
 *
 * The rule is JSON-encoded because that is how the resource table reads
 * filters back off the URL. Columns are deliberately left alone: the `columns`
 * param replaces the whole visible set, so naming any here would hide whatever
 * the operator had chosen.
 *
 * @param orderGroupId prefixed id of the group, as the API reports it
 */
export function orderGroupSearch(orderGroupId: string): { filters: string } {
  const rule = {
    id: `order-group-${orderGroupId}`,
    field: 'order_group',
    operator: 'eq',
    value: orderGroupId,
  }

  return { filters: JSON.stringify([rule]) }
}