# Ecommerce Checkout: Promo Code Step

A working code field that applies live, adds the discount line, reprices the pay button, and states plainly what codes exclude.

- Page: https://www.shadcn-ui-blocks.com/blocks/ecommerce-pro/checkouts/promo-code-step
- Collection: [Ecommerce](https://www.shadcn-ui-blocks.com/blocks/ecommerce-pro), Standard tier
- Group: [Checkout](https://www.shadcn-ui-blocks.com/blocks/ecommerce-pro/checkouts)
- Created: 2026-07-04
- Preview image: https://www.shadcn-ui-blocks.com/blocks/ecommerce-pro/checkouts/promo-code-step.png

## Install

```bash
npx shadcn@latest add @shadcn-ui-blocks/ecommerce-pro-checkouts-promo-code-step
```

Needs an API key from a Pro or Team plan: add `@shadcn-ui-blocks` to the registries in components.json with the key as an `Authorization: Bearer` header. Setup: https://www.shadcn-ui-blocks.com/docs/shadcn-cli. The MCP server installs it without the setup: https://www.shadcn-ui-blocks.com/docs/mcp.

## Depends on

- npm packages: class-variance-authority, lucide-react, radix-ui
- shadcn/ui components: button, input, label
- Installs to: `@/components/blocks/ecommerce-pro/checkouts/promo-code-step`

## About this block

Promo Code Step is step 3 of 3 in the checkout, a working
Input plus Apply Button from ui/input and ui/button that
takes a code, drops a discount line into the totals, and
reprices both the total and the pay button live. Once a
code applies, the field swaps for a Tag row naming the
code with a Remove link that reverts every number. The
copy stays honest about where real codes live, in the
newsletter and on socials, never saved for insiders, and
what they exclude, one code per order on full price items
with sale prices already at their floor.

The applied code is a single string state, null until
Apply fires, and the totals array conditionally splices
the discount line based on it. The pay button always shows
the price after the code, and the footer keeps stacking
and expiry news here rather than on the receipt.

## When to use

Reach for this block as the discount stage of checkout,
after totals are known and before payment. Wire the field
to your real code validation so an expired or non stacking
code says so in place, not after the charge.

A natural flow around it on an Ecommerce Pro page:

**Before**

- [Order summary sidebar](https://www.shadcn-ui-blocks.com/blocks/ecommerce-pro/checkouts)

**After**

- [Payment form](https://www.shadcn-ui-blocks.com/blocks/ecommerce-pro/checkouts)
- [Order tracking](https://www.shadcn-ui-blocks.com/blocks/ecommerce-pro/order-tracking)

## What you can display

One strong use is the single field that reprices totals
and the button together. Other code configurations:

- **Auto applied code.** A campaign code arrives already
  applied, shown in the Tag row with the option to remove.
- **Stacked rejection.** A second code entered while one
  is live explains why it will not stack in place.
- **Store credit field.** The same pattern crediting a
  gift card or refund balance against the subtotal.

> Tip: keeping the pay button in sync with the discount
> means the buyer never learns the real number one screen
> too late.

## More in Ecommerce Checkout

- [Address Validation Helper](https://www.shadcn-ui-blocks.com/blocks/ecommerce-pro/checkouts/address-validation-helper)
- [Billing Address Toggle](https://www.shadcn-ui-blocks.com/blocks/ecommerce-pro/checkouts/billing-address-toggle)
- [Business Purchase Checkout](https://www.shadcn-ui-blocks.com/blocks/ecommerce-pro/checkouts/business-purchase-checkout)
- [Delivery Date Picker](https://www.shadcn-ui-blocks.com/blocks/ecommerce-pro/checkouts/delivery-date-picker)
- [Delivery Notes Step](https://www.shadcn-ui-blocks.com/blocks/ecommerce-pro/checkouts/delivery-notes-step)
- [Duties And Taxes Step](https://www.shadcn-ui-blocks.com/blocks/ecommerce-pro/checkouts/duties-and-taxes-step)
- [Express Checkout Wall](https://www.shadcn-ui-blocks.com/blocks/ecommerce-pro/checkouts/express-checkout-wall)
- [Express Pay Buttons](https://www.shadcn-ui-blocks.com/blocks/ecommerce-pro/checkouts/express-pay-buttons)
- [Gift Receipt Toggle Step](https://www.shadcn-ui-blocks.com/blocks/ecommerce-pro/checkouts/gift-receipt-toggle-step)
- [Guest Or Account Choice](https://www.shadcn-ui-blocks.com/blocks/ecommerce-pro/checkouts/guest-or-account-choice)
- [Installment Plan Choice](https://www.shadcn-ui-blocks.com/blocks/ecommerce-pro/checkouts/installment-plan-choice)
- [Invoice Details Form](https://www.shadcn-ui-blocks.com/blocks/ecommerce-pro/checkouts/invoice-details-form)
- [Multi Step Checkout](https://www.shadcn-ui-blocks.com/blocks/ecommerce-pro/checkouts/multi-step-checkout)
- [One Page Checkout](https://www.shadcn-ui-blocks.com/blocks/ecommerce-pro/checkouts/one-page-checkout)
- [Order Confirmation Page](https://www.shadcn-ui-blocks.com/blocks/ecommerce-pro/checkouts/order-confirmation-page)
- [Order For Someone Else Step](https://www.shadcn-ui-blocks.com/blocks/ecommerce-pro/checkouts/order-for-someone-else-step)
- [Order Review Step](https://www.shadcn-ui-blocks.com/blocks/ecommerce-pro/checkouts/order-review-step)
- [Order Summary Sidebar](https://www.shadcn-ui-blocks.com/blocks/ecommerce-pro/checkouts/order-summary-sidebar)
- [Payment Failed Recovery](https://www.shadcn-ui-blocks.com/blocks/ecommerce-pro/checkouts/payment-failed-recovery)
- [Payment Form Section](https://www.shadcn-ui-blocks.com/blocks/ecommerce-pro/checkouts/payment-form-section)
- [Pickup Point Selector](https://www.shadcn-ui-blocks.com/blocks/ecommerce-pro/checkouts/pickup-point-selector)
- [Quote To Checkout](https://www.shadcn-ui-blocks.com/blocks/ecommerce-pro/checkouts/quote-to-checkout)
- [Returning Customer Checkout](https://www.shadcn-ui-blocks.com/blocks/ecommerce-pro/checkouts/returning-customer-checkout)
- [Review And Place Order](https://www.shadcn-ui-blocks.com/blocks/ecommerce-pro/checkouts/review-and-place-order)
- [Shipping Options List](https://www.shadcn-ui-blocks.com/blocks/ecommerce-pro/checkouts/shipping-options-list)
