|
| 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. |
0 commit comments