Order Basket Analytics
query_order_basket_analyticsAnalyse orders filtered by what is IN the basket (which products, and how many units), broken down by region, channel or month. Answers questions the pre-computed dashboard context cannot, such as 'orders containing two chairs, average shipping cost per region'. Returns order counts, net revenue, and BOTH shipping figures: what customers were charged (revenue) and what fulfilment actually cost the merchant, with an explicit coverage percentage for the cost side.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum groups to return, highest order count first. Defaults to 50. | |
| end_date | Yes | Inclusive end of the window, YYYY-MM-DD, in the store's timezone. | |
| group_by | No | Dimension to break results down by. Defaults to 'none' (one total row). | |
| start_date | Yes | Inclusive start of the window, YYYY-MM-DD, in the store's timezone. | |
| product_ids | No | Only count orders whose basket contains these products. Get IDs from resolve_products. Omit to analyse all orders in the window. | |
| min_quantity | No | Order must contain at least this many units across product_ids. Use for 'two or more chairs'. Mutually exclusive with exact_quantity. | |
| region_codes | No | Restrict to these ISO 3166-1 alpha-2 shipping country codes, e.g. ['AU','NZ']. | |
| sales_channel | No | Restrict to a single sales channel value. | |
| exact_quantity | No | Order must contain exactly this many units across product_ids. Use for 'orders with two chairs'. Mutually exclusive with min_quantity. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| note | No | Present only when no orders matched. | |
| _meta | No | ||
| groups | No | ||
| _message | No | ||
| currency | No | ||
| truncated | No | Present only when the matched order set hit the internal cap. | |
| _truncated | No | ||
| group_count | No | ||
| groups_omitted | No | Present only when `limit` cut groups from the response. | |
| _tenant_context | No | ||
| filters_applied | No | ||
| truncation_note | No | ||
| matched_order_count | No | ||
| shipping_metric_definitions | No | Definitions of the shipping metrics, restating that charged is revenue and cost is the merchant outlay. Absent on the no-matches branch. | |
| fulfillment_cost_coverage_percent | No | Coverage across every matched order, not per group. |