# Coupons

> CouponForm, CouponAppliedList, and CouponRemoveButton as the cart coupon family.

<!-- Sources: src/Components/Woo/CouponForm/CouponForm.php; src/Components/Woo/CouponAppliedList/CouponAppliedList.php; src/Components/Woo/CouponRemoveButton/CouponRemoveButton.php; client/src/domains/woo/components/coupon-form.ts; client/src/domains/woo/cart-store.ts; src/Woo/CartItemsDynamicSource.php; src/Testing/E2E/Woo/WooScenarioProvider.php; tests/e2e/components/woo/behavior.spec.ts -->

# Coupons

This family applies, lists, and removes Woo cart coupons.

## Components

| Component key | Role |
| --- | --- |
| `OmeWooCouponForm` | Applies a coupon code through Store API. |
| `OmeWooCouponAppliedList` | Renders active cart coupons. |
| `OmeWooCouponRemoveButton` | Removes the current coupon row. |

## Authoring Structure

```text
CouponForm
CouponAppliedList
  CouponRemoveButton
```

`CouponRemoveButton` belongs inside `CouponAppliedList` because the runtime injects the coupon code into each row and button.

## CouponForm Props

| Prop | Meaning |
| --- | --- |
| Input hint copy | Text shown inside the coupon code field before entry. |
| `content.button_label` | Submit button text. |
| `accessibility.input_aria_label` | Input accessible label. |
| `accessibility.button_aria_label` | Button accessible label. |

If the submitted code is empty, the form moves to `error` without calling Store API.

## CouponAppliedList Props

| Prop | Meaning |
| --- | --- |
| `content.show_empty_message` | Shows an empty message when no coupons are applied. |
| `content.empty_message` | Empty message text. |
| `preview.rows` | Number of coupon rows in builder preview. |
| `preview.empty_state` | Shows empty state in builder preview. |

Runtime state is `has-coupons` or `empty`.

## CouponRemoveButton Props

| Prop | Meaning |
| --- | --- |
| `content.label` | Button text. |
| `accessibility.aria_label` | Button accessible label. |

The runtime reads `data-ome-woo-coupon-remove-code` or `data-ome-woo-coupon-code` from the hydrated row.

## Runtime Behavior

Applying or removing a coupon calls Store API and refreshes the cart store. Woo Store API coupon mutations can omit totals, so `WooCartStore` refreshes the cart after coupon responses when totals are missing.

## Scenario Coverage

| Scenario | Covered behavior |
| --- | --- |
| `cart_coupons` | Valid coupon creates a row, changes discount totals, invalid coupon renders notice text, and remove returns totals. |
