Apply Discount Code
Apply a coupon or affiliate code to the cart.
Updated
On this page
Overview
Apply a discount or coupon code to the cart. The discount is validated and applied server-side.
SDK Usage
import dash from "@/lib/dash"
// Apply discount
const { message, cart } = await dash.cart.applyDiscount("SAVE20")
// cart.discount_code = "SAVE20"
// cart.discount_amount = "15.00"
// Remove discount
const result = await dash.cart.removeDiscount()