PromoCodeInput
Discount-code control for applying, showing, and removing promo codes in cart and checkout flows.
Best for
Import
import { PromoCodeInput } from "@enadhq/enad-react-sdk/client/cart"When to use it
Use PromoCodeInput in carts and checkout summaries when the customer should be able to apply or remove one or more discount codes inline.
Composition notes
The component delegates the real discount behavior upward. onApply, onRemove, appliedCodes, isApplying, and error should all reflect the same pricing source of truth as the order totals.
Behavior and theming guidance
Keep promo feedback direct. If a code fails, the reason should be visible immediately. If a code succeeds, the updated discount should be easy to connect to the summary totals nearby.
Examples
Live examples you can edit directly in the sandbox.
Apply and remove codes
Keep the applied-code list and any validation errors in parent state so the discount logic stays close to pricing calculations.
Component Sets
Preview the first example across the available component-set presets to compare tone, spacing, and structural defaults.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| onApply | (code: string) => void | — | No description yet. |
| onRemove | string | — | No description yet. |
| appliedCodes | string | [] | No description yet. |
| isApplying | boolean | false | No description yet. |
| error | string | — | No description yet. |
| labels | string | {} | No description yet. |
| className | string | No description yet. |