magento2-40251: Salesrule product attributes being queried on every cart request
Community fix magento2-40251 merged into magento/magento2 on 2026-06-05, not in a release yet; applies cleanly to 2.4.9.
Fixes salesrule product attributes being queried on every cart request edited
- Pull request title
- Magento\SalesRule\Model\Plugin\QuoteConfigProductAttributes::afterGetProductAttributes getting triggered on all Cart Queries
- Pull request
- magento/magento2#40251
- Issues
- #40226 human
- Author
- @senthilengg
- Merged
- 2026-06-05
- Fixed in
- no release yet
- Reported on
- —
- Categories
- Price/Tax, Shopping Cart
- Components
- magento/module-sales-rule
Labels
- Area
- Catalog
- Component
- SalesRule
- Priority
- P3
- Severity
- —
- Reported on (labels)
- 2.4.x
Issue
Title and steps come from the upstream issue and pull request.
Description
Steps to reproduce
2. Enable DB Query Log
3. Hit the cart page URL
4. To confirm the query fired run , cat var/log/db.log | grep "salesrule_product_attribute" from magento root
Expected result
Actual result
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 conflict 2.4.6-p1 conflict 2.4.6-p2 conflict 2.4.6-p3 conflict 2.4.6-p4 conflict 2.4.6-p5 conflict 2.4.6-p6 conflict 2.4.6-p7 conflict 2.4.6-p8 conflict 2.4.6-p9 conflict 2.4.6-p10 conflict 2.4.6-p11 conflict 2.4.6-p12 conflict 2.4.6-p13 conflict 2.4.6-p14 conflict 2.4.6-p15 conflict | 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: test files do not apply to this releaseunit: could not run before, could not run after |
Triage
Model @cf/cloudflare/clef. Probability this is a bug fix: 93.7%. Probability it is security relevant: 0.7%.
Show the model's answers and probabilities
| Question | Answer | Probabilities | Confidence |
|---|---|---|---|
| Change kind | bugfix | bugfix 89.8%, refactor 5.4%, feature 3.0%, tests_only 0.9%, dependency 0.5%, docs_only 0.4% | 77.3% |
| Area | checkout | checkout 75.4%, catalog 8.0%, framework 7.0% | 52.3% |
| Reported version | unspecified | unspecified 43.7%, 2.4.6 1.5%, 2.4.9 1.4% | 18.6% |
| Scope | 1.40 of 2 | 2 54.9%, 1 30.7%, 0 14.4% | 12.4% |
| Risk | 1.33 of 2 | 2 52.0%, 1 28.9%, 0 19.0% | 8.6% |
| Worth backporting | 0.91 of 2 | 1 42.5%, 0 33.2%, 2 24.3% | 2.5% |
Download
For cweagans/composer-patches, choose a version below and download the bundle. Copy its magento2-40251/ 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-40251 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/40251 Issue: https://github.com/magento/magento2/issues/40226 Author: @senthilengg Source commit: 78eac7826bc05dea79bea4997148c1b1e6a24215 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.
