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

# Cart Integration

> How box products appear and behave in the WooCommerce cart.

BoxBuilder integrates deeply with WooCommerce's cart system. When a customer adds a box to the cart, it appears as a single, clean line item with the box contents displayed beneath it.

## How It Works

Under the hood, BoxBuilder uses a **hidden sub-items pattern**:

1. The **parent item** is the box product itself — this is what the customer sees in the cart
2. Each selected product is added as a **hidden child item** — invisible to the customer but tracked by WooCommerce for stock management

This architecture means:

* WooCommerce handles stock reduction for each individual product automatically
* Coupons, taxes, and shipping work with standard WooCommerce calculations
* No custom database tables or workarounds needed

## Cart Display

The box appears in the cart as a single item with:

* Box product name and image
* Price (based on your pricing model)
* Box contents listed below the item name
* Gift message (if provided)
* Quantity (fixed at 1 per box by default)

### Cart Settings

Configure cart behavior in **BoxBuilder → Settings → Cart**:

| Setting | Description | Default |
| - | - | - |
| **Show cart contents** | Display box contents in the cart | Yes |
| **Box quantity editable** | Allow changing box quantity in cart | No |
| **After add redirect** | Where to go after adding to cart | Cart page |

### After Add to Cart Redirect

| Option | Behavior |
| - | - |
| **Cart** | Redirect to the cart page |
| **Checkout** | Redirect directly to checkout |
| **Stay** | Stay on the current page (with a success notice) |

## Removing a Box

When a customer removes a box from the cart, all hidden child items are automatically removed too. There's no way for orphaned child items to remain in the cart.

## Cart Item Visibility

Child items are hidden from:

* The cart table (customer view)
* The mini cart / cart widget
* The cart totals

But they are still tracked internally for:

* Stock management (each product's stock is reduced at checkout)
* Order line items (visible in admin)
* Inventory reports

## Pricing in Cart

| Pricing Model | Parent Item Price | Child Item Prices |
| - | - | - |
| **Fixed** | Full box price (e.g., \$29.99) | \$0.00 each |
| **Per-Item** | \$0.00 | Each item's WooCommerce price |
| **Hybrid** | Base box price (e.g., \$10.00) | Each item's WooCommerce price |

## WooCommerce Cart Blocks

BoxBuilder is compatible with the WooCommerce Cart block (block-based cart). Child items are filtered from the Store API response so they don't appear in the block-based cart.

## Mini Cart

Box items display correctly in the WooCommerce mini cart widget. Child items are hidden — only the parent box item is shown.

## Related

* [Orders & Emails](https://docs.swiftlywp.com/plugins/boxbuilder/orders-and-emails.md) — how boxes appear in orders
* [Pricing Models](https://docs.swiftlywp.com/plugins/boxbuilder/pricing-models.md) — pricing configuration
* [Inventory](https://docs.swiftlywp.com/plugins/boxbuilder/inventory.md) — stock management


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.