PromoCodeInput
React SDK guidance for PromoCodeInput.
Exact exports, props, slots, hooks, and runtime behavior belong to SDK package reference. Examples are guidance unless explicitly marked copy-paste-safe.
Review component intent and composition guidance before wiring this component into an app. Then use the live playground to confirm the rendered behavior.
Playground
- Import path:
@enadhq/enad-react-sdk/client/cart. - Live playground: /components/commerce/promo-code-input.
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 canonical reference 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.
Contract scope
- Use SDK package reference for exact props, exports, slots, hooks, and runtime behavior.
- Public import:
@enadhq/enad-react-sdk/client/cart. - Playground route: /sandbox?component=PromoCodeInput.
- Copy/paste scope: guidance-only. Treat examples as guidance until checked against SDK package reference.