Skip to content

Commit f2104e8

Browse files
committed
[Discounts] Configuration
1 parent ed00f6a commit f2104e8

File tree

3 files changed

+60
-23
lines changed

3 files changed

+60
-23
lines changed

docs/discounts/configure_discounts.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
description: Install the Discounts LTS update.
3+
month_change: true
4+
editions:
5+
- lts-update
6+
- commerce
7+
---
8+
9+
# Discounts configuration
10+
11+
You can customize the behavior of the Discounts feature using the following [configuration](configuration.md):
12+
13+
## Back Office pagination
14+
15+
Use the built-in SiteAccess-aware parameters to change the default pagination settings.
16+
17+
The following parameters are available:
18+
19+
- `list_per_page_limit` controls the number of discounts displayed on a single page in discount list view
20+
- `products_list_per_page_limit` controls the number of products displayed on a single page in a discount details view
21+
22+
You can set them as in the following example:
23+
24+
``` yaml
25+
ibexa:
26+
system:
27+
admin_group:
28+
discounts:
29+
pagination:
30+
list_per_page_limit: 10
31+
products_list_per_page_limit: 15
32+
```
33+
34+
## Rate limiting
35+
36+
To prevent malicious actors from trying all the possible discount code combinations using brute-force attacks, the [`/discounts_codes/{cartIdentifier}/apply` endpoint](/api/rest_api/rest_api_reference/rest_api_reference.html#discount-codes-apply-discount-to-cart) is rate limited using the [Rate Limiter Symfony component]([[= symfony_doc =]]/rate_limiter.html).
37+
38+
You can adjust the default configuration by modifying the `config/packages/ibexa_discounts_codes.yaml` file created during installation process.
39+
40+
The limiter uses the following pattern: `user_%d_ip_%s`, using Customer ID and Customer IP address to track usage of both logged-in and anonymous customers.
41+
To cover additional use cases, you can add your own logic by listening to the [`BeforeDiscountCodeApplyEvent`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-DiscountsCodes-Event-BeforeDiscountCodeApplyEvent.html) event.
42+
43+
## Checkout error-handling
44+
45+
A discount can be valid when customer enters the cart, but later become invalid before the checkout process is completed.
46+
47+
For example, this event could occur if the discount expired, was modified, disabled, or deleted before the customer completed the checkout process.
48+
49+
To prevent customers from placing such orders, the Discounts feature comes with built-in error-handling.
50+
Once it detects that a discount that can no longer be used is applied to a product, it stops the checkout process and informs the customer.
51+
52+
This error handling is provided by two event subscribers:
53+
54+
- `Ibexa\Bundle\Checkout\EventSubscriber\DiscountsHaveChangedExceptionSubscriber`
55+
- `Ibexa\Bundle\DiscountsCodes\EventSubscriber\DiscountCodeUnusableExceptionSubscriber`
56+
57+
You can be disable this behavior by setting the `ibexa_checkout.error_handlers.enabled` container parameter to `false`, which allows you to provide your own solution for these cases.

docs/discounts/install_discounts.md

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ editions:
88

99
# Install Discounts
1010

11-
Discounts are available as an LTS update to [[= product_name_com =]], starting with version v4.6.19 or higher.
11+
Discounts are available as an LTS update to [Ibexa Commerce](ibexa_commerce.md), starting with version v4.6.19 or higher.
1212
To use this feature you must first install the packages and configure them.
1313

1414
## Install packages
@@ -43,25 +43,4 @@ Run the following command, where `<database_name>` is the same name that you def
4343

4444
This command modifies the existing database schema by adding database configuration required for using Discounts.
4545

46-
### Configuration (optional)
47-
48-
Use the built-in SiteAccess-aware parameters to change the default discount configuration.
49-
50-
The following settings are available:
51-
52-
- `list_per_page_limit` controls the number of discounts displayed on a single page in discount list view
53-
- `products_list_per_page_limit` controls the number of products displayed on a single page in a discount details view
54-
55-
You can set them as in the following example:
56-
57-
``` yaml
58-
ibexa:
59-
system:
60-
admin_group:
61-
discounts:
62-
pagination:
63-
list_per_page_limit: 10
64-
products_list_per_page_limit: 15
65-
```
66-
67-
You can now restart you application and start working with the Discounts feature.
46+
You can now review the existing [configuration options](configure_discounts.md) to adjust this feature, or restart your application to start working with it.

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,7 @@ nav:
405405
- Discounts: discounts/discounts.md
406406
- Discounts guide: discounts/discounts_guide.md
407407
- Install Discounts: discounts/install_discounts.md
408+
- Configure Discounts: discounts/configure_discounts.md
408409
# - Extend Discounts: discounts/extend_discounts.md
409410
- Customer management:
410411
- Customer Portal: customer_management/customer_portal.md

0 commit comments

Comments
 (0)