Student & Nonprofit Discount Card — Free HTML CSS JS Snippet

Student & Nonprofit Discount Card · Pricing · Plain HTML, CSS & JS · Live preview

Share & Support

What's included

Features

Fully computed discount math
Discounted price and annual savings derive from two constants.
Verification-required notice
Sets expectations before the CTA, not after checkout.
Distinct identity options
Student vs. nonprofit paths, not a generic coupon field.
Mocked verification hand-off
Models a redirect to a real eligibility provider.
Honest completed-state copy
States a real timeline instead of implying instant activation.
Struck-through original price
Makes the discount visually legible at a glance.
Dark, distinct visual theme
Amber accent differentiates it from other pricing cards.
Zero dependencies
Pure HTML, CSS, and vanilla JS.

About this UI Snippet

Student & Nonprofit Discount Card — Computed Discount, Verification Notice, and a Distinct Eligibility Flow

Screenshot of the Student & Nonprofit Discount Card snippet rendered live

Student and nonprofit discounts are structurally different from a generic promo code: they require proving eligibility, not just knowing a string. Applying a coupon code is instant and self-serve; a student or nonprofit discount typically routes through a third-party eligibility-verification service (SheerID and similar providers are common in production) that checks a .edu email, an enrollment record, or a nonprofit registry before the discount actually activates. This snippet models that distinction directly in the UI instead of collapsing it into a generic "have a code?" input.

A discount that's genuinely computed

The full price, discount percentage, discounted price, and annual savings are not four separately hand-typed numbers that happen to agree — only FULL_PRICE and DISCOUNT_PCT are set directly; everything else is derived: discountedPrice = FULL_PRICE * (1 - DISCOUNT_PCT / 100) and annualSavings = (FULL_PRICE - discountedPrice) * 12. At \$20/month and 60% off, that's \$8/month and \$144/year in savings — change either constant and every displayed figure recalculates consistently, which is exactly the property you want when the same discount logic might later drive a real checkout total.

The verification notice sits above the CTA, not after it

Rather than let a visitor assume the discount applies the moment they click "Subscribe," the .sdc-verify block states plainly, before any button is pressed, that eligibility is confirmed by a verification partner before the discount activates. Setting that expectation early avoids the frustrating pattern of a visitor completing checkout only to discover afterward that a follow-up verification step stands between them and the price they thought they'd locked in.

A distinct flow, not a coupon input

Clicking the CTA doesn't reveal a text field for a code — it reveals two identity options ("I'm a student" / "I work at a nonprofit"), because the two paths verify against different data sources in a real implementation (an academic email or enrollment record versus a nonprofit registry lookup). This is deliberately modeled apart from a coupon card or promo code input, which apply immediately against a known code with no external verification step.

A mocked hand-off that mirrors the real one

The setTimeout after picking a verification type stands in for a real redirect to a verification provider, which returns control to your app via a webhook or redirect once eligibility is confirmed — that's why the completed state explicitly says "We'll email you within 1 business day" rather than "You're now on the discounted plan," since real verification is rarely instant.

Customizing it

Swap in your real full price and discount percentage — the computed fields update automatically — and replace the mocked setTimeout with an actual redirect to your verification provider's hosted flow, resuming this component's completed state once their webhook confirms eligibility.

Build with AI

Build, Understand, Optimize, and Extend It With AI

Paste this snippet into an AI coding assistant like Claude and ask it to explain why discountedPrice and annualSavings are computed from FULL_PRICE and DISCOUNT_PCT rather than hardcoded, and why the verification flow uses distinct student/nonprofit identity options instead of a single generic coupon-code field. It's also useful for extending the flow — ask it to wire the mocked setTimeout hand-off to a real verification provider's SDK or hosted redirect, add a .edu email pre-check that pre-selects the student path, or build the equivalent "discount already applied, pending expiration" state for a previously verified user whose eligibility needs periodic re-confirmation.

Prompt to recreate it

Copy this into your AI assistant of choice to build the effect from scratch, or as a jumping-off point for your own variant:

text
Build a "student and nonprofit discount pricing card" in plain HTML, CSS, and JavaScript with no dependencies.

Requirements:
- Show a discounted price for a named plan, where only a full price constant and a discount percentage constant are set directly in the code — the discounted monthly price and the annual dollar savings must both be computed from those two constants (not separately hardcoded), so changing either constant updates every displayed number consistently and correctly.
- Display the original price with a strikethrough next to the discounted price, plus a savings line stating both the percentage off and the computed annual dollar savings.
- Include a clearly visible "verification required" notice, placed before the call-to-action button, explaining that eligibility is confirmed by a verification step before the discount activates — do not let the CTA imply the discount applies immediately.
- Clicking the CTA must NOT reveal a generic coupon-code text input. Instead reveal two distinct identity options (e.g. "I'm a student" and "I work at a nonprofit"), since real student/nonprofit verification checks different eligibility criteria depending on which applies.
- Selecting an identity option triggers a mocked hand-off (e.g. a short delayed transition) simulating a redirect to a third-party eligibility-verification provider, then shows a completed state.
- The completed state must use honest, non-instant copy — state that the user will be notified once their status is confirmed (e.g. "within 1 business day"), rather than claiming the discount is active immediately, since real identity verification in production is rarely instant.

Want to tighten it up first? Run this prompt through the AI Prompt Studio to score it across 8 quality dimensions, catch anti-patterns, and tune the wording for Claude, ChatGPT, or Gemini before you paste it in.

Step by step

How to Use

  1. 1
    Read the computed priceThe discounted price and annual savings are derived from FULL_PRICE and DISCOUNT_PCT, not hardcoded.
  2. 2
    Note the verification noticeThe card states upfront that eligibility is confirmed before the discount activates.
  3. 3
    Click the CTAA verification panel appears offering student or nonprofit identity options.
  4. 4
    Choose an optionA mocked hand-off simulates redirecting to a verification partner.
  5. 5
    See the completed stateA confirmation explains the discount applies once eligibility is confirmed by email.
  6. 6
    Adjust the discountChange FULL_PRICE or DISCOUNT_PCT and every derived figure recalculates.

Real-world uses

Common Use Cases

Education-focused SaaS
Offer verified student pricing distinct from a public discount.
Nonprofit tooling
Route nonprofit eligibility through a dedicated verification step.
Alongside a coupon flow
Pair with promo code input for general discounts.
Plan comparison pages
Sit beside a standard pricing card.
Onboarding for .edu users
Trigger this card after detecting an academic email domain.
Community/open-source tools
Offer nonprofit pricing without a manual approval queue.

Got questions?

Frequently Asked Questions

A coupon code proves nothing about who is applying it — anyone with the string gets the discount instantly. Student and nonprofit discounts need to verify an actual eligibility fact (enrollment status, nonprofit registration), which is why this card routes through a distinct verification step with identity options instead of a text field, and why the completed state describes a follow-up confirmation rather than instant activation.

Yes. Only FULL_PRICE ($20) and DISCOUNT_PCT (60) are set directly in the JS; discountedPrice and annualSavings are both calculated from them (20 * 0.4 = $8/month, and $12 saved per month * 12 = $144/year). Changing either constant updates every displayed number consistently, since nothing is hand-typed as a separate hardcoded string.

No — this is a self-contained front-end demo, so the setTimeout after choosing student or nonprofit simulates a redirect to a real verification provider. In production, replace that timeout with an actual redirect (or embedded widget) from a provider like SheerID, and only show the completed state once their callback or webhook confirms eligibility.

Because real identity verification against academic or nonprofit records is rarely instant in production — some checks resolve in seconds, others require manual review. Stating a realistic timeframe upfront avoids the worse experience of a visitor expecting immediate activation and being confused when the discount doesn't yet appear on their account.

Some products auto-detect a likely student by checking for a .edu (or country-equivalent academic) email domain during signup and pre-selecting the student path, while still requiring the same underlying verification step to actually apply the discount — auto-detection can speed up the flow, but should never replace real verification, since email domains can be spoofed or reused after graduation.