Discount 100 Off
A sample discount adapter demonstrating a fixed-amount coupon code (100 CHF off). Use this as a template for implementing your own coupon systems.
Installation
import '@unchainedshop/plugins/pricing/discount-100-off';
How It Works
- User enters coupon code
100OFF - Adapter validates the code
- Returns a fixed discount of 100.00 (10000 cents) to be applied by Order Discount
Coupon Code
| Code | Effect |
|---|---|
100OFF | 100.00 off total order (case-insensitive) |
Usage
Apply the discount:
mutation ApplyDiscount {
addCartDiscount(code: "100OFF") {
_id
total {
amount
currencyCode
}
}
}
Remove the discount:
mutation RemoveDiscount {
removeCartDiscount(discountId: "discount-id") {
_id
}
}
Configuration
The adapter targets shop.unchained.pricing.order-discount:
discountForPricingAdapterKey: ({ pricingAdapterKey }) => {
if (pricingAdapterKey === 'shop.unchained.pricing.order-discount') {
return { fixedRate: 10000 }; // 100.00 in cents
}
return null;
},
Adapter Details
| Property | Value |
|---|---|
| Key | shop.unchained.discount.100-off |
| Version | 1.0.0 |
| Order Index | 10 |
| Manual Addition | Yes |
| Manual Removal | Yes |
| System Triggering | No |
| Source | pricing/discount-100-off.ts |
Related
- Discount Half Price - Percentage discount
- Order Discount - Order-level discount pricing
- Order Discounts - Creating custom discounts