magento2-40653: Cart price rule discount being dropped when editing an order in admin
Community fix magento2-40653 merged into magento/magento2 on 2026-06-25, not in a release yet; applies cleanly to 2.4.9.
Fixes cart price rule discount being dropped when editing an order in admin edited
- Pull request title
- Cart Price Rule with limited usage is not applied when editing an existing order in Admin (e.g. "Uses per Customer = 1")
- Pull request
- magento/magento2#40653
- Issues
- #40624 human
- Author
- @lbajsarowicz
- Merged
- 2026-06-25
- Fixed in
- no release yet
- Reported on
- 2.4.8-p3
- Categories
- Order/Checkout, Price/Tax
- Components
- magento/module-sales, magento/module-sales-rule
Labels
- Area
- Order
- Component
- SalesRule
- Priority
- P2
- Severity
- —
- Reported on (labels)
- 2.4.8-p3
Issue
Title and steps come from the upstream issue and pull request.
Description
Magento re-validates the rule usage and blocks the discount because the usage limit has already been reached.
Steps to reproduce
- A discount (e.g. 50%)
- Limited usage configured (e.g. Uses per Customer = 1)
<img width="1455" height="897" alt="Image" src="https://github.com/user-attachments/assets/8e8bf39e-aead-435a-9d35-7168388dd9c2" />
2. On the storefront, place an order as a customer using this rule until the usage limit is reached.
3. In the Admin Panel, navigate to Sales → Orders.
4. Open the order that was placed using the discount.
5. Click Edit.
<img width="1572" height="873" alt="Image" src="https://github.com/user-attachments/assets/1d714f13-ae91-4d72-b307-8e68068a6d8f" />
6. Modify the order (e.g. change product quantity or update items).
7. Check whether the discount is applied to the edited order.
<img width="1579" height="861" alt="Image" src="https://github.com/user-attachments/assets/1cb29120-f062-4a9a-a8bd-ed8f1bd163fb" />
Expected result
Actual result
Magento re-validates the rule usage and blocks the discount because the usage limit has already been reached.
<img width="1579" height="861" alt="Image" src="https://github.com/user-attachments/assets/1cb29120-f062-4a9a-a8bd-ed8f1bd163fb" />
Taken from the upstream issue.
Code match per tag
Each tag was checked with git apply --check against that tag's files. A clean match means the change applies; it is not a test result. Tags that already contain the fix are marked.
| Line | Code match per tag | Tests |
|---|---|---|
| 2.4.6 | 2.4.6 file-missing 2.4.6-p1 file-missing 2.4.6-p2 file-missing 2.4.6-p3 file-missing 2.4.6-p4 file-missing 2.4.6-p5 file-missing 2.4.6-p6 file-missing 2.4.6-p7 file-missing 2.4.6-p8 file-missing 2.4.6-p9 file-missing 2.4.6-p10 file-missing 2.4.6-p11 file-missing 2.4.6-p12 file-missing 2.4.6-p13 file-missing 2.4.6-p14 file-missing 2.4.6-p15 file-missing | 2.4.6: no test data 2.4.6-p1: no test data 2.4.6-p2: no test data 2.4.6-p3: no test data 2.4.6-p4: no test data 2.4.6-p5: no test data 2.4.6-p6: no test data 2.4.6-p7: no test data 2.4.6-p8: no test data 2.4.6-p9: no test data 2.4.6-p10: no test data 2.4.6-p11: no test data 2.4.6-p12: no test data 2.4.6-p13: no test data 2.4.6-p14: no test data 2.4.6-p15: no test data |
| 2.4.7 | 2.4.7 conflict 2.4.7-p1 conflict 2.4.7-p2 conflict 2.4.7-p3 conflict 2.4.7-p4 conflict 2.4.7-p5 conflict 2.4.7-p6 conflict 2.4.7-p7 conflict 2.4.7-p8 conflict 2.4.7-p9 conflict 2.4.7-p10 conflict | 2.4.7: no test data 2.4.7-p1: no test data 2.4.7-p2: no test data 2.4.7-p3: no test data 2.4.7-p4: no test data 2.4.7-p5: no test data 2.4.7-p6: no test data 2.4.7-p7: no test data 2.4.7-p8: no test data 2.4.7-p9: no test data 2.4.7-p10: no test data |
| 2.4.8 | 2.4.8 conflict 2.4.8-p1 conflict 2.4.8-p2 conflict 2.4.8-p3 conflict 2.4.8-p4 conflict 2.4.8-p5 conflict | 2.4.8: no test data 2.4.8-p1: no test data 2.4.8-p2: no test data 2.4.8-p3: no test data 2.4.8-p4: no test data 2.4.8-p5: no test data |
| 2.4.9 | 2.4.9 clean | 2.4.9: fails before (after: fail)unit: fails before, passes after · integration: fails before, fails after |
Triage
Model @cf/cloudflare/clef. Probability this is a bug fix: 98.3%. Probability it is security relevant: 1.0%.
Show the model's answers and probabilities
| Question | Answer | Probabilities | Confidence |
|---|---|---|---|
| Change kind | bugfix | bugfix 95.9%, refactor 1.4%, tests_only 1.0%, feature 0.8%, dependency 0.5%, docs_only 0.4% | 90.4% |
| Area | checkout | checkout 74.8%, admin 15.5%, other 3.8% | 52.7% |
| Reported version | 2.4.8-p3 | 2.4.8-p3 63.6%, 2.4.8 2.4%, 2.4.8-p4 1.7% | 39.9% |
| Scope | 0.78 of 2 | 0 44.7%, 1 33.0%, 2 22.4% | 3.8% |
| Risk | 1.32 of 2 | 2 54.0%, 1 23.6%, 0 22.3% | 9.7% |
| Worth backporting | 1.59 of 2 | 2 65.1%, 1 28.6%, 0 6.2% | 26.5% |
Download
For cweagans/composer-patches, choose a version below and download the bundle. Copy its magento2-40653/ folder into patches/composer/, merge composer.patches.json into composer.json, then run composer install. Test files are always removed; paths are relative to each package root, using the default -p1 level.
Bundle README (what the ZIP ships)
# magento2-40653 Community fix merged upstream into magento/magento2, adapted by magento.watch. This is not a patch published by Adobe. Pull request: https://github.com/magento/magento2/pull/40653 Issue: https://github.com/magento/magento2/issues/40624 Author: @lbajsarowicz Source commit: 8b5e33902651dcf214f79a24a6f660328b17565f Modifications: test files and documentation removed, paths rewritten relative to each Composer package. Licence: OSL-3.0 / AFL-3.0, as the original Magento Open Source code. Maintainer: Łukasz Bajsarowicz (@lbajsarowicz)
Licence: Magento Open Source code under OSL-3.0 and AFL-3.0. The bundle carries the original author, source commit and the list of modifications.
