Discount
3 min
A component used to apply discount to current cart.
Properties
Generic
- Discount Options - configuration of discount codes and values
- Code storage path - path at which applied code is saved in dataLayer
- Value storage path - path at which applied discount value is saved in dataLayer
- Text field label - text to be displayed above textfield
- Button label - text visible on the submit button
- Success message - text to display below input field on successful submission
- Error message - text to display below input field on unsuccessful submission
- Alignment - horizontal alignment of this component
Styles section
Discount Options
Discount configuration consists of two fields: code and value.
If value is a floating point number between 0 and 1, it's treated as a discount percentage. If value is greater or equal 1, then applied discount is an absolute value.
Value | Discount |
|---|---|
0.1 | -10% |
0.25 | -25% |
15 | -15$ |
99 | -99$ |
Code is a text that needs to be provided by the user to apply a discount of particular value. Code can be:
- exact text to be matched
- text with wildcard (*) sign
- Regular Expression (/.../g) - RegExp Cheat Sheet
Code | Matching input |
|---|---|
Promo10 | Promo10 |
Promo* | Promo10, Promo20, Promoxyz, Promo,... |
Promo*Code | PromoCode, PromoXYZCode, Promo1Code,... |
/Promo[0-9]{2}/g | Promo10, Promo20, Promo99,... |