Discount
The Discount type is a basic discount that is applied to an order or individual items when certain conditions are met.
General Information
When creating a discount, fill in the main fields:
- Name — the name of the discount for display in the interface.
- Marker — a required field. A unique string identifier for use in the application code.
- Type — general discount or personal discount.
After creation, you need to specify additional details within the discount:
- Start Date — a required field. The date from which the discount becomes effective.
- End Date — an optional field. If not specified, the discount is valid indefinitely.
Conditions
Conditions define when the discount will be applied. Multiple conditions can be combined using the AND rule (all conditions must be met) or OR (only one is sufficient).
| Condition | Description |
|---|---|
| Product | The discount is applied if the specified product is in the order |
| Category | The discount is applied if there is a product from the specified category in the order |
| Product Attribute | The discount is applied if there is a product with certain attributes in the order |
| Product (dynamic) | Similar to the "Product" condition, but requires passing the discount marker in additionalDiscountsMarkers |
| Category (dynamic) | Similar to the "Category" condition, but requires passing the discount marker in additionalDiscountsMarkers |
| Minimum Order Amount | The discount is applied only when the specified order amount is reached |
| User LTV | The discount is applied based on the total amount of user payments |
If other discounts are already applied to the items in the order, the minimum amount is calculated after applying discounts to the items.
For example: the minimum amount for the discount is 1000 ₽. The order contains 10 items at 100 ₽ each = 1000 ₽. However, each item has a 5% discount, resulting in a total order amount of 950 ₽. Since 950 < 1000, the discount for the entire order is not applied.
Application
Configure how the discount will be calculated:
-
Discount Type:
- No discount — the discount is not applied.
- Percentage of product/order cost — the discount is calculated as a percentage.
- Fixed discount amount — a fixed price reduction.
- Fixed price — the product will have the specified fixed price.
-
Value — the numerical value of the discount according to the selected type.
-
Maximum Value — relevant for percentage type. Defines the maximum amount that the discount can reach. The formula used is:
min(calculated value, maximum value). -
Application:
- To product — the discount is displayed at the product level and is visible at the
/productsendpoints when all conditions are met. - To order — the discount is applied when creating or pre-calculating the order.
- To product — the discount is displayed at the product level and is visible at the
Coupons
Coupons can be linked to the discount. A discount with a coupon is applied only when the coupon code is provided in the couponCode field of the request.
Manual Coupon
A coupon with a custom name that can be used an unlimited number of times.
Allowed characters: Latin letters, numbers, - and _.
Coupon Generation
Coupons can be generated based on a mask, where:
A— is replaced with a random letter9— is replaced with a random digit
For example, the mask AAAA-9999 will create coupons like XKBM-4721.
If you need to keep the character A or 9 literally in the coupon code, it can be escaped.
The mask must contain at least 5 special characters (A or 9).
When pre-calculating an order with a one-time coupon, the discount will be shown, but the coupon will not be used. When creating an order, the coupon is marked as used and will not work again.
Gifts
Gifts can be added to the discount — products that will appear in the order at a price of 0.
- Gift Product is selected from the list of products.
- Behavior on Match — if the customer adds the same product that is a gift to the order, this setting determines the behavior:
- The product remains paid, and another item of the same product is added to the order at a price of 0 (as a gift).
- The product in the order becomes free (replaced with the gift version).
Exclusions
You can specify products or categories that will be excluded from the discount conditions (the "Product," "Category," and their dynamic variants). Products or categories from the exclusion list will not be considered when checking the conditions.