Coupon Code Box Widget
Give readers a discount code they can copy in one tap: your headline, the code in a dashed ticket, the terms in plain words, the last day it works and a button to your shop. When the date passes it says so instead of pretending.
Live preview
Under the widget on your page: Powered by A2Z Tools
Embed code
<div data-a2z-kit="coupon-code-box"></div> <script async src="https://a2z.tools/embed/kit.js" referrerpolicy="no-referrer"></script>
One small script from A2Z draws the component on your page inside its own Shadow DOM. It loads no social-network or tracking scripts and sets no cookies. How the A2Z kit works.
Works with
How it works
Type the headline, the code and the terms. Codes may use 1 to 40 letters, digits, hyphens and underscores - the characters every shop platform accepts - and anything else is not displayed, so what a visitor copies is exactly what your checkout expects. The Copy button writes the code to the clipboard, turns green with the word Copied for two seconds and announces it to screen readers. If you set a last day as YYYY-MM-DD, the code is treated as valid until the end of that day in the time zone you name (an IANA name such as America/New_York or Europe/London); leave the zone blank to use each visitor's own clock. The end of the day is worked out with the browser's time-zone data, so daylight-saving changes are handled. After it, the box says This code has expired, strikes the code through, disables Copy and removes the shop button - or disappears completely if you choose to hide expired codes. There is no ticking countdown or hurry message; the date is simply stated. The Shop now button takes https links only.
Method
- Valid code = ^[A-Za-z0-9_-]{1,40}$ (surrounding spaces trimmed)
- Expires at = 00:00 on the day after the last day, in the chosen IANA zone (or the visitor's zone), converted to UTC
- Expired when now >= expires at; the state is re-checked once at that instant if the page is open
- Copy: navigator.clipboard.writeText, with the classic copy command as fallback; announced through a polite live region
Worked examples
A New York sale ending on New Year's Eve
Inputs: Code NEWYEAR25, last day 2026-12-31, zone America/New_York
Result: Valid until the end of 31 December 2026 (New York time); from 2027-01-01 05:00 UTC the box shows This code has expired and Copy is disabled
New York is five hours behind UTC in winter, so local midnight is 05:00 UTC.
A code typed with a mistake
Inputs: Code SAVE 10% (with a space and a percent sign)
Result: No code is shown; the builder preview explains that codes use 1-40 letters, digits, - or _
A visitor could never apply a code containing a space, so it is not offered for copying.
London across the October clock change
Inputs: Last day 2026-10-24, zone Europe/London
Result: Expires at 2026-10-24 23:00 UTC
On 24 October London is still on summer time (UTC+1), so its midnight falls at 23:00 UTC.
Limitations
- Does not validate the code against your shop; keep it in step with the discount you created there.
- Expiry is by whole days; a code cannot end at a particular hour.
- One code per box; use two boxes for two offers.
Where publishers use it
- A newsletter landing page offering WELCOME15 to new subscribers, with the terms line spelling out the minimum spend
- A food blogger's recipe post sharing a partner's discount code with a clear last day and a link to the shop
- A seasonal sale page whose code ends on 30 November in New York time, after which the box quietly says the code has expired
- A podcast's show-notes page listing a listener code that stays valid with no end date
Questions
Why is there no countdown timer?
A ticking clock is built to rush people, and many countdowns online are simply invented. The box states the last day once and changes to This code has expired when that day is over. If you need a visible countdown for a genuine sale, the Sale Countdown Banner does that separately.
Which time zone decides when the code expires?
The one you enter, such as Europe/London or Asia/Kolkata. A code with the last day 2026-12-31 in America/New_York stops working at 00:00 on 1 January New York time, which is 05:00 UTC, for every visitor wherever they are. Leave the zone blank and each visitor's own midnight is used, which is usually not what a shop means, so naming the zone your checkout uses is safer.
Does the widget check that the code works at my checkout?
No. It shows and copies what you typed. Create the code in your shop platform first, use the same spelling and the same end date, and test it once. The widget refuses characters that most platforms reject, so a stray space or symbol cannot slip in.
What do visitors see if copying is blocked?
Some browsers block clipboard access in certain frames or private modes. The button then announces that copying failed and repeats the code, and the code itself is shown in large monospaced letters that can be selected and typed by hand.
Cite or recommend this tool
If you reference this tool in an article, course or documentation, these formats are ready to copy. They are optional - nothing is added to your site unless you paste it.
A2Z Tools Coupon Code Box https://a2z.tools/embed/coupon-code-box
<a href="https://a2z.tools/embed/coupon-code-box">A2Z Tools Coupon Code Box</a>
[A2Z Tools Coupon Code Box](https://a2z.tools/embed/coupon-code-box)
Coupon Code Box by A2Z Tools - https://a2z.tools/embed/coupon-code-box
Related widgets
-
A slim banner with your offer headline, a live countdown and an optional Shop now button.
-
A bar fixed to the top or bottom of your page with one message and one button - after a scroll, between dates.
-
The cards and wallets your shop takes - Visa, PayPal, Apple Pay, UPI, iDEAL - as tidy tiles or footer glyphs.
-
Sale price and savings, including stacked discounts and sales tax on the reduced price.
-
A scroll-to-top button that waits until readers scroll, with a progress ring and keyboard-friendly focus.
-
A slim bar or small circle that fills as visitors read your article - measured through the article itself.