Carts
A comprehensive list of the cart resource's fields and attributes
Within Commerce Layer, every order that's not yet placed acts as a shopping cart. Orders get created in draft status and become pending when they have a customer and some line items associated.
Commerce Layer Metrics API cart addresses this subset of orders — the ones that are in draft or pending status — and lets you perform different types queries on the /carts/{{query_type}}
endpoint to gather stats and information about your organization cart history:
The results of each query can be filtered based on specific fields and operators:
FiltersYou can easily see it in action by checking these simple examples:
ExamplesThe Metrics API provides the full cart history starting from August 1st, 2022.
If you need to do statistics on real orders (i.e. placed, approved, or cancelled orders), please use the /orders
endpoint (read more here).
Fields and attributes
Please reference to this list for a comprehensive view of all the cart resource's fields and attributes, accessible through the Metrics API:
billing_address
field
billing_address
fieldAttribute | Type | Description |
---|---|---|
| Boolean | Indicates if the address is a business or a personal one. |
| String | The city specified in the address. |
| String | The international 2-letter country code (as defined by the ISO 3166-1 standard) specified in the address. |
| Boolean | Indicates if the address has been successfully geocoded. |
| Boolean | Indicates if the latitude and longitude of the address are present, either geocoded or manually updated. |
| String | The state, province or region code specified in the address. |
| String | The ZIP or postal code specified in the address. |
customer
field
customer
fieldAttribute | Type | Description |
---|---|---|
| String | The ID of the customer. |
| String | The email address of the customer. |
| String | The name of the customer group the customer belongs to (if any). |
line_items
field
line_items
fieldAttribute | Type | Description |
---|---|---|
| String | The code of the associated SKU or bundle. |
| Number | The discount applied to the line item (float). |
| String | The ID of the line item. |
| String | The ID of the associated item. |
| String | The type of the associated item. One of |
| String | The name of the line item. When missing, it gets populated with the name of the associated item (if present). |
| Number | The amount of the line item option (float). |
| Integer | The line item's quantity. |
| Number | The collected tax amount for the line item (float). Otherwise calculated as the line item's |
| Number | The tax rate for the line item (if calculated). |
| Number | The total amount of the line item (float). Calculated as the line item's |
| Number | The unit amount of the line item (float). |
| String | The date and time at which the line item was last updated (complete date plus hours, minutes and seconds — according to the ISO 8601 standard). |
| Object | The line item options (see the related table for all the single option objects attributes). |
Line item options
field
options
fieldAttribute | Type | Description |
---|---|---|
| String | The ID of the line item option. |
| String | The name of the line item option. When missing, it gets populated with the name of the associated SKU option. |
| Integer | The line item option's quantity. |
| Number | The total amount of the line item option (float). Calculated as the line item option's |
| Number | The unit amount of the line item option (float). |
market
field
market
fieldAttribute | Type | Description |
---|---|---|
| String | The ID of the market. |
| String | The name of the market. |
| Integer | The numeric unique identifier for the market. |
order
field
order
fieldAttribute | Type | Description |
---|---|---|
| String | The lower limit of the date and time range used to filter the collected orders (complete date plus hours, minutes and seconds — according to the ISO 8601 standard). |
| String | The upper limit of the date and time range used to filter the collected orders (complete date plus hours, minutes and seconds — according to the ISO 8601 standard). |
| String | The date field (e.g. |
| Boolean | Indicates a discount has been applied to the order. |
| Boolean | Indicates if a gift card has been (or is set to be) used to pay — in total or in part - for the order. |
| String | The order's payment status. Always |
| String | The order's fulfillment status. Aways |
| Boolean | Indicates if a coupon code has been (or is set to be) used to pay — in total or in part — for the order. |
| Boolean | Indicates if at least one line item of the order has at least an option. |
| Number | The sum of all the adjustments applied to the order (float). |
| Number | The taxes applied to the order's adjustments (float). |
| Number | The order's adjustment taxable amount (float). |
| String | The international 2-letter country code (as defined by the ISO 3166-1 standard), automatically inherited from the order's shipping address. |
| String | The coupon code to be used to pay — in total or in part — for the order. If valid, it triggers a promotion adding a discount line item to the order. |
| String | The date and time at which the order was created (complete date plus hours, minutes and seconds — according to the ISO 8601 standard). |
| String | The international 3-letter currency code (as defined by the ISO 4217 standard), automatically inherited from the order's market. |
| Number | The sum of all the discounts applied to the order (float). |
| Number | The duty amount that is calculated by external services (float). |
| Boolean | Indicates if taxes are applied to shipping costs. |
| String | The gift card code (at least the first 8 characters) to be used to pay — in total or in part — for the order. If valid, it uses the associated gift card balance. |
| Number | The sum of all the gift cards applied to the order (float). |
| Boolean | Indicates if the order has been placed as guest (by a non-logged in customer). |
| String | The ID of the order. |
| String | The preferred language code (as defined by the ISO 639-1 standard) to be used when communicating with the customer when checking out the order. |
| Integer | The total number of line item options associated with the order's line items. |
| Integer | The numeric unique identifier for the order. |
| Number | The costs of the payment method associated with the order (float). |
| Number | The taxes applied to the order's payment method costs (float). |
| Number | The order's payment method taxable amount (float). |
| String | Any external identifier that might be useful to link the order resource to other systems through the Commerce Layer core API. |
| String | Any identifier of the 3rd-party system that defines the reference code. |
| Integer | The total number of shipments associated with the order. |
| Number | The sum of all the shipping costs of the order (float). |
| Number | The order's shipping taxable amount (float). |
| Integer | The total number of SKUs in the order's line items. |
| String | The order status. One of |
| Number | The sum of all the SKU line items total amounts (float). |
| Number | The taxes applied to the order's subtotal (float). |
| Number | The order's subtotal taxable amount (float). |
| Boolean | Indicates if taxes are included in the order amounts (automatically inherited from the order's price list). |
| Number | The order's total amount (float). |
| Number | The order's total amount, taxes included (float). |
| Number | The sum of all the taxes applied to the order (float). |
| Number | The order's total taxable amount (float). |
| String | The date and time at which the order was last updated (complete date plus hours, minutes and seconds — according to the ISO 8601 standard). |
| String | The date and time of the order's latest status change, regardless of the order's status (complete date plus hours, minutes and seconds — according to the ISO 8601 standard). |
| String | Searchable field containing all carts data. |
payment_method
field
payment_method
fieldAttribute | Type | Description |
---|---|---|
| String | The ID of the payment method. |
| String | The payment source type. One of |
| String | The payment source type, titleized. |
| Boolean | Indicates if the payment has been marked as MOTO (must be supported by the payment gateway). |
shipping_address
field
shipping_address
fieldAttribute | Type | Description |
---|---|---|
| Boolean | Indicates if the address is a business or a personal one. |
| String | The city specified in the address. |
| String | The international 2-letter country code (as defined by the ISO 3166-1 standard) specified in the address. |
| Boolean | Indicates if the address has been successfully geocoded. |
| Boolean | Indicates if the latitude and longitude of the address are present, either geocoded or manually updated. |
| String | The state, province or region code specified in the address. |
| String | The ZIP or postal code specified in the address. |
tags
field
tags
fieldAttribute | Type | Description |
---|---|---|
| String | The tag ID. |
| String | The tag name. |
Last updated