Back to blocks
BlockeCommerceFree

Coupon Code Block React component

A discount code card: type a code (validated with a spinner, shaking with a clear message when invalid or below its minimum spend) or pick one of the available coupon tickets, with a 'Best value' tag, locked coupons that say how much more to add, an applied ticket with a confetti pop, and totals that count down.

About the Coupon Code Block component

Coupon Code Block takes the guesswork out of discount codes. People can type a code or simply tap one of the coupons they're eligible for, and the best one right now is marked so nobody has to do the math.

When something doesn't work, the message says exactly why, including how much more to add for a minimum-spend coupon. A successful code turns into a ticket with a small celebration, and the total counts down to the new price.

When to use it

Use it in the cart, the checkout summary, or a 'my offers' section of an account page.

For the full order review use the Order Summary Block; for an automatic offer use the Cart Offer Modal.

Installation

Add the Coupon Code Block component to your project with the shadcn CLI. It lands in components/coupon-code-block.tsx as plain React + Tailwind CSS source you own and can edit.

Install
Copied!
npx shadcn@latest add @reactframe/coupon-code-block

Or copy the source by hand and install its dependencies:

Install
Copied!
npm install motion clsx tailwind-merge

More eCommerce components

Order Bump Block
Free
Product Filters Sidebar
Free
Free Shipping Progress Bar
Free
Mini Cart Drawer
Free
Upsell / Cross-sell Block
Free
Product Carousel Block
Free