DashForDevsDocs
DocsNewsAPI v1
dashfordevs.comSign in

© 2026 DashForDevs

DocsNewsdashfordevs.comLegalStatus
DocsDiscountsDiscount Codes
Introduction
Getting Started
Authentication
Products
Categories
Cart
Checkout
Blog
Reviews
Webhooks
Customers
Orders
Inventory
Shipping
Discounts
Discount CodesAffiliate CodesBulk PricingValidate Code
Affiliates
Email
Media & Files
Analytics & Tracking
Locations
Tax
Global Data
SEO
Error Handling
Geography
Finance
Automations
Page Types
Surveys
Billing & Subscriptions
Storefront Payments
SDK Reference
REST API
Storefront Architecture
Notifications
Security
Team & Permissions
Migrations & Import
Calendar & Appointments
Contact Forms
AI Bots
Dashboard API
Deployment
Changelog
Troubleshooting
Recipes
CLI & Deployment
Image Pipeline
White-label Platforms
Records Engine
Platform Modules
Platform Security
Site Keys & Client Sites
Use Cases
Operations

Discount Codes

Create and manage percentage and fixed-amount coupons.

Updated March 29, 2026

On this page
  • Overview
  • Types of Discounts
  • Applying a Code
  • Validating a Code
  • Creating Codes (Dashboard)
  • Next Steps

Overview

Discount codes allow customers to get price reductions at checkout. Codes are created and managed in the dashboard.

Types of Discounts

TypeDescriptionExample
PercentageReduce by a percentage of the subtotal20% off → SAVE20
Fixed AmountReduce by a fixed dollar amount$10 off → TENOFF
Free ShippingWaive shipping costsFREESHIP

Applying a Code

typescript
import dash from "@/lib/dash"

// Apply to cart
const { cart } = await dash.cart.applyDiscount("SAVE20")
console.log(cart.discount_code)    // "SAVE20"
console.log(cart.discount_amount)  // "15.00"

Validating a Code

typescript
// Validate without applying
const response = await fetch("/storefront/discount/validate", {
  method: "POST",
  headers: { "Content-Type": "application/json", "X-API-Key": apiKey },
  body: JSON.stringify({ code: "SAVE20", subtotal: "75.00" }),
})
const result = await response.json()
// { valid: true, is_percentage: true, rate: "20", discount_amount: "15.00" }

Creating Codes (Dashboard)

  1. Go to Marketing → Discounts
  2. Click Create Discount Code
  3. Set the code, discount type, and amount
  4. Optionally set: minimum order amount, max uses, expiration date
  5. Save

Next Steps

  • Affiliate Codes — Affiliate-generated codes
  • Bulk Pricing — Quantity-based discounts
  • Validate Code — Code validation details
  • Apply Discount Code — Using codes in cart
PreviousShipping LocationsNextAffiliate Codes

On this page

  • Overview
  • Types of Discounts
  • Applying a Code
  • Validating a Code
  • Creating Codes (Dashboard)
  • Next Steps