> ## 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.

# How do blocks work?

> Understand Aftersell Cart blocks: sections and sub-blocks, filled vs empty, limits, locked blocks, conditions, and per-block settings.

Your cart's layout is a stack of **blocks**: configurable pieces you add, reorder, style, and customize in the cart editor. Which blocks you include, and in what order, is the cart shoppers see.

For how blocks sit inside **states** and **sections**, see [How do carts work?](https://docs.aftersell.com/aftersell/cart/how-carts-work.md).

## Blocks and sub-blocks

There are two kinds of block:

* **Blocks** sit directly in the cart, in one of three sections: **Header**, **Body**, or **Footer**. Each section offers a different set of blocks.
* **Sub-blocks** nest inside another block. Today only [**Cart items**](https://docs.aftersell.com/aftersell/cart/cart-items-block.md) hosts sub-blocks: the **Product** row (the line-item row itself), [**Subscription upgrade**](https://docs.aftersell.com/aftersell/cart/subscription-upgrade-block.md), and [**Custom code**](https://docs.aftersell.com/aftersell/cart/custom-code-blocks.md).

## Adding, reordering, and removing blocks

* **Add** a block with the **Add block** picker. A block is greyed out if it can't go where you're adding it, or if you've reached its limit (the picker shows a `count/max` badge).
* **Reorder** by dragging a block within its section.
* **Remove** with the trash icon, except locked blocks (below).
* **Show/hide** most blocks with the eye toggle, which hides a block from shoppers without deleting it. A few structural blocks can't be hidden: **Cart items**, **Checkout button**, and the **Product** row.

## Locked blocks

Some blocks can be reordered but not deleted, so core cart behavior (for example, checking out) can't be removed by accident:

* **Cart items**
* **Checkout button**

## Default blocks

New carts start with a working default layout:

* **Filled cart:** Header, Banner, Cart items, Summary, Checkout button
* **Empty cart:** Header, Empty cart block

> [!NOTE]
>
> The **empty cart state** is the whole empty layout. The **Empty cart block** is one block inside it. See [How do carts work?](https://docs.aftersell.com/aftersell/cart/how-carts-work.md) for the difference.

## How many of each block you can add

Limits are counted **per cart state**, not per cart. The filled cart and the empty cart each get their own allowance, so a cart can hold three Banners in its filled layout and three more in its empty layout.

Most blocks are limited to one per state. The exceptions:

| Block | Maximum per cart state |
| - | - |
| Banner | 3 |
| Image | 3 |
| Product add-on | 3 |
| Summary | 2 |
| Custom code | Unlimited |

## Content, Design, and Code

Each block is configured through up to three surfaces in the editor:

* **Content**: the block's settings (text, product choices, thresholds, and so on). The **Custom code** block is the one exception: it has no Content panel because the block *is* the code.
* **Design**: per-block styling that layers on top of your global [**Design settings**](https://docs.aftersell.com/aftersell/cart/design-settings.md). Every block has one except **Custom code**, which has no settings panel at all.
* **Code**: override the block's built-in rendering with a [**custom template**](https://docs.aftersell.com/aftersell/cart/custom-templates.md). Most blocks support this; a couple don't.

## Show or hide by market, country, or currency

Some blocks can show different settings, or hide entirely, based on who the buyer is. That is separate from the sidebar **eye toggle**, which turns a block on or off for everyone.

| | **Eye toggle** | **Conditions** |
| - | - | - |
| **What it does** | Hide or show the whole block for all shoppers | Pick which settings variant a shopper sees (or nothing) |
| **Based on** | Your choice in the editor | Shopify market, customer country, or customer currency |
| **Where** | Sidebar eye icon on most blocks | Settings panel for blocks that support conditions |

**Supported condition types today:** Shopify market, customer country, and customer currency (each with **In** or **Not in**). Cart total and cart contents are **not** condition types. Use [Rewards](https://docs.aftersell.com/aftersell/cart/rewards-block.md) tier thresholds for spend/quantity progress, or the [Cart SDK](https://docs.aftersell.com/aftersell/cart/sdk-overview.md) when you need a rule the editor can't express.

Conditions are an ordered list: the **first matching** condition wins. Put specific rules above an **All buyers** catch-all. If nothing matches, the block renders nothing for that shopper.

**In the editor today**, the full Conditions UI ships on the [**Rewards**](https://docs.aftersell.com/aftersell/cart/rewards-block.md#per-market-rewards) block: different tier sets per market, country, or currency. Other blocks either use a single “all buyers” configuration or don't participate in this system yet.

Editor preview does **not** evaluate the live buyer. Select a condition in the panel to preview that variant.

## All blocks

**Structure**

* [Header](https://docs.aftersell.com/aftersell/cart/header-block.md): title, item count, logo, and close control, pinned to the top.
* [Cart items](https://docs.aftersell.com/aftersell/cart/cart-items-block.md): the items customers add to cart; repeats per line.
* [Subscription upgrade](https://docs.aftersell.com/aftersell/cart/subscription-upgrade-block.md): sub-block that offers to convert a line to a subscription.
* [Summary](https://docs.aftersell.com/aftersell/cart/summary-block.md): totals, savings, and applied discounts.
* [Checkout button](https://docs.aftersell.com/aftersell/cart/checkout-button-block.md): the primary call-to-action to checkout.
* [Empty cart](https://docs.aftersell.com/aftersell/cart/empty-cart-block.md): the content shown when the cart is empty.
* [Express payments](https://docs.aftersell.com/aftersell/cart/express-payments-block.md): accelerated checkout buttons (Shop Pay, PayPal, and so on) inside the cart.

**Merchandising**

* [Upsells](https://docs.aftersell.com/aftersell/cart/upsells-block.md): strategy-picked product recommendations.
* [Product add-on](https://docs.aftersell.com/aftersell/cart/product-add-on-block.md): a single specific product offered as an add-on.
* [Rewards](https://docs.aftersell.com/aftersell/cart/rewards-block.md): tiered rewards such as free shipping or gifts.
* [Shipping protection](https://docs.aftersell.com/aftersell/cart/shipping-protection-block.md): an opt-in shipping-protection add-on.

**Shopper input**

* [Discount code](https://docs.aftersell.com/aftersell/cart/discount-code-block.md): a field to apply a discount code.
* [Notes](https://docs.aftersell.com/aftersell/cart/notes-block.md): an order-notes field.

**Content**

* [Banner](https://docs.aftersell.com/aftersell/cart/banner-block.md): a message banner, with an optional countdown timer.
* [Image](https://docs.aftersell.com/aftersell/cart/image-block.md): a single image or a hosted preset such as payment icons.
* [Custom code](https://docs.aftersell.com/aftersell/cart/custom-code-blocks.md): custom HTML or React anywhere in the cart.

**Extending**

* [Custom templates](https://docs.aftersell.com/aftersell/cart/custom-templates.md): override how any block renders from its Code tab.

## Blocks available in each section

Each section has a different set of blocks available. That keeps the layout focused and reduces clutter.

| Section | Blocks available |
| - | - |
| **Header** | Header, Banner, Rewards, Image, Custom code |
| **Body** | Banner, Notes, Discount code, Cart items, Empty cart, Custom code, Rewards, Product add-on, Shipping protection, Image, Upsells |
| **Footer** | Banner, Notes, Discount code, Custom code, Rewards, Product add-on, Shipping protection, Express payments, Image, Upsells, Summary, Checkout button |

Some of those blocks are state-specific (for example Empty cart only in the empty state). See [How do carts work?](https://docs.aftersell.com/aftersell/cart/how-carts-work.md).

## Block validation errors

If a block's settings contain an invalid value, a small red dot appears next to that block's name in the sidebar. The dot stays until you fix the problem. It isn't a dismissible notification.

While any block has an error, **saving is blocked**. The **Save** button stays clickable, but selecting it shows an error toast (*"Fix the errors in your cart blocks before saving"*) and jumps to the first block with a problem, opening its settings so you can correct the highlighted field. **Publish** additionally requires no unsaved changes, so it stays unavailable until a clean save succeeds.

Once the invalid field is corrected the dot disappears on its own, and saving proceeds normally.

> [!NOTE]
>
> Hidden blocks are still validated. A block you've hidden can hold an invalid setting, show an error dot, and block saving exactly like a visible one, so if saving is blocked and every visible block looks fine, check your hidden blocks.
