-
Notifications
You must be signed in to change notification settings - Fork 82
[Discounts] Configuration #2781
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
1b2d817
[Discounts] Configuration
mnocon 09fed3a
Added cards + self review
mnocon 29aa9a5
Apply suggestions from code review
mnocon 30e78d9
Changed link to use variable
mnocon b5b96a5
Merge branch 'discounts-rest' into discounts-configuration
adriendupuis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
--- | ||
Check warning on line 1 in docs/discounts/configure_discounts.md
|
||
description: Install the Discounts LTS update. | ||
month_change: true | ||
editions: | ||
- lts-update | ||
- commerce | ||
--- | ||
|
||
# Discounts configuration | ||
|
||
You can customize the behavior of the Discounts feature by using the following [configuration](configuration.md): | ||
|
||
## Back Office pagination | ||
|
||
Use the built-in SiteAccess-aware parameters to change the default pagination settings. | ||
|
||
The following parameters are available: | ||
|
||
- `list_per_page_limit` controls the number of discounts displayed on a single page in discount list view | ||
- `products_list_per_page_limit` controls the number of products displayed on a single page in a discount details view | ||
|
||
You can set them as in the following example: | ||
|
||
``` yaml | ||
ibexa: | ||
system: | ||
admin_group: | ||
discounts: | ||
pagination: | ||
list_per_page_limit: 10 | ||
products_list_per_page_limit: 15 | ||
``` | ||
## Rate limiting | ||
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). | ||
|
||
You can adjust the default configuration by modifying the `config/packages/ibexa_discounts_codes.yaml` file created during installation process. | ||
|
||
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. | ||
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. | ||
Check failure on line 41 in docs/discounts/configure_discounts.md
|
||
|
||
## Checkout error-handling | ||
|
||
A discount can be valid when customer enters the cart, but later become invalid before the checkout process is completed. | ||
|
||
For example, this event could occur if the discount expired, was modified, disabled, or deleted before the customer completed the checkout process. | ||
|
||
To prevent customers from placing such orders, the Discounts feature comes with built-in error-handling. | ||
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. | ||
|
||
This error handling is provided by two event subscribers: | ||
|
||
- `Ibexa\Bundle\Checkout\EventSubscriber\DiscountsHaveChangedExceptionSubscriber` | ||
- `Ibexa\Bundle\DiscountsCodes\EventSubscriber\DiscountCodeUnusableExceptionSubscriber` | ||
|
||
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. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.