Stats

A comprehensive list of the stats query keys, allowed fields values, and operators for the cart resource

To perform a stats query on the cart resource send a POST request to the /carts/stats endpoint specifying in the payload the query keys and filter parameters like in the generic example below:

{
  "stats": {
    "field": "...",
    "operator": "..."
  },
  "filter": { ... }
}

Please find more information on how stats queries work here.

Query keys

These are the keys you need to set when performing a stats query:

KeyTypeRequiredDescriptionValues

field

String

The field you want the metrics or statistics computed on.

See the table below to check the full list of valid values for this key.

operator

String

The computing operator.

See the table below to check the full list of valid operators based on the value you assigned to the field key.

Operators and field values

These are the valid values you can specify for the field key of the stats query and the related valid operators, based on that key:

ValueOperators

customer.id

cardinality

value_count

customer.email

cardinality

value_count

customer.group_name

cardinality

value_count

line_items.code

cardinality

value_count

line_items.discount

avg

max

min

sum

stats

line_items.id

cardinality

value_count

line_items.item_id

cardinality

value_count

line_items.options_amount

avg

max

min

sum

stats

line_items.quantity

avg

max

min

sum

stats

line_items.tax_amount

avg

max

min

sum

stats

line_items.tax_rate

avg

max

min

sum

stats

line_items.total_amount

avg

max

min

sum

stats

line_items.unit_amount

avg

max

min

sum

stats

line_items.options.id

cardinality

value_count

line_items.options.quantity

avg

max

min

sum

stats

line_items.options.total_amount

avg

max

min

sum

stats

line_items.options.unit_amount

avg

max

min

sum

stats

market.id

cardinality

market.number

cardinality

value_count

order.adjustment_amount

avg

max

min

sum

stats

order.adjustment_tax_amount

avg

max

min

sum

stats

order.adjustment_taxable_amount

avg

max

min

sum

stats

order.discount_amount

avg

max

min

sum

stats

order.duty_amount

avg

max

min

sum

stats

order.gift_card_code

value_count

order.gift_card_amount

avg

max

min

sum

stats

order.id

cardinality

value_count

order.line_item_options_count

avg

max

min

sum

stats

order.number

value_count

order.payment_method_amount

avg

max

min

sum

stats

order.payment_method_tax_amount

avg

max

min

sum

stats

order.payment_method_taxable_amount

avg

max

min

sum

stats

order.reference

cardinality

value_count

order.reference_origin

cardinality

value_count

order.shipments_count

avg

max

min

sum

stats

order.shipping_amount

avg

max

min

sum

stats

order.shipping_taxable_amount

avg

max

min

sum

stats

order.skus_count

avg

max

min

sum

stats

order.subtotal_amount

avg

max

min

sum

stats

order.subtotal_tax_amount

avg

max

min

sum

stats

order.subtotal_taxable_amount

avg

max

min

sum

stats

order.total_amount

avg

max

min

sum

stats

order.total_amount_with_taxes

avg

max

min

sum

stats

order.total_tax_amount

avg

max

min

sum

stats

order.total_taxable_amount

avg

max

min

sum

stats

Last updated