> ## Documentation Index
> Fetch the complete documentation index at: https://docs.aftersell.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Summary block

> The Aftersell Cart Summary block: totals, savings, and applied discount codes.

> The **Summary** block shows the shopper what they'll pay: a total row with optional savings, plus applied discount tags. It summarizes the cart's totals and savings just above the checkout button, so shoppers see the bottom line before they commit.

<Frame>
  <img src="https://mintcdn.com/aftersell/1Y3gBpUfxv16VGSW/images/aftersell/cart-summary-block-subtotal-savings-applied-discounts.png?fit=max&auto=format&n=1Y3gBpUfxv16VGSW&q=85&s=455f22040697c41fd1e02a870e9cccf8" alt="Summary block displaying subtotal, savings, and applied discounts before checkout" width="1368" height="250" data-path="images/aftersell/cart-summary-block-subtotal-savings-applied-discounts.png" />
</Frame>

## Behavior

* **Savings tokens collapse gracefully.** If a cell references `{{savings}}` or `{{pre_savings_price}}` but the cart has no saving, that cell falls back to just `{{total_price}}`, so shoppers never see "\$0.00 off" or a struck price equal to the total. If you combine `{{cart_item_count}}` and `{{savings}}` in the same cell, the item count is also removed in the no-savings fallback — put them in separate cells to avoid this.
* Discount tags appear only when **Show discount codes** is on *and* the cart has discounts to list. This includes both code-based and automatic discounts.

## Settings

| Setting                 | What it controls                                                                                        | Default                          |
| ----------------------- | ------------------------------------------------------------------------------------------------------- | -------------------------------- |
| **Left text**           | The left cell of the total row. Rich text with tokens. Example: `Subtotal ({{cart_item_count}} items)`. | `Subtotal`                       |
| **Right text**          | The right cell. Rich text with tokens (total, struck pre-savings price, savings, item count).           | Total with struck savings markup |
| **Savings format**      | Show savings as a whole `percent` or an `absolute` amount.                                              | `percent`                        |
| **Show discount codes** | Whether applied discount tags appear. This includes both code-based and automatic discounts.            | On                               |

The text cells support the `{{cart_item_count}}`, `{{total_price}}`, `{{pre_savings_price}}`, and `{{savings}}` tokens.

## Placement and limits

* **Region:** bottom.
* **Maximum:** 2 per cart state — the filled cart and the empty cart each get their own allowance.
* **State:** both filled and empty cart.
* Added to new carts by default. Not locked, so you can remove or hide it.

## Custom template

Supports a [custom template](/aftersell/cart/custom-templates) from its Code tab, which replaces this block's built-in markup with your JSX. These are the props it receives.

| Prop                | Type       | What it's for                                                                                                                 |
| ------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------- |
| `leftHtml`          | `string`   | The left cell as sanitized HTML, with tokens resolved.                                                                        |
| `rightHtml`         | `string`   | The right cell as sanitized HTML, with tokens resolved.                                                                       |
| `discountCodes`     | `string[]` | Discount titles applied to the cart (code-based and automatic). `[]` when none.                                               |
| `showDiscountCodes` | `boolean`  | Whether the merchant wants discount tags listed **and** the cart has discounts to list.                                       |
| `hasSavings`        | `boolean`  | `true` when the cart has a saving. Use it to hide your own savings row.                                                       |
| `totalPrice`        | `string`   | Cart total, already formatted.                                                                                                |
| `preSavingsPrice`   | `string`   | Total before savings, already formatted.                                                                                      |
| `savings`           | `string`   | Amount saved. Already formatted, **or a percentage** like `15%`, depending on the merchant's savings-format setting.          |
| `itemCount`         | `number`   | Total units in the cart — visible line quantities summed, excluding the shipping-protection line.                             |
| `isLoading`         | `boolean`  | Always `false` here: the block renders its built-in skeleton during load and only calls your template once the cart is ready. |

<Warning>
  Because `savings` can be either money or a percentage, don't build your own sentence around it that assumes one. `{props.savings}` on its own is safe; `You saved ${props.savings}` is not.
</Warning>

## Design

Style this block with its **Design** section in the settings panel. These are per-block overrides that layer on top of your global design and fall back to it when blank.

What are design settings? Learn more here: [Design settings](/aftersell/cart/design-settings).
