{"data":{"id":"magento2-37918","source":"github-pr","sourceRef":"magento/magento2#37918","title":"Refund with negative qty alway refund discound ","pr":{"number":37918,"url":"https://github.com/magento/magento2/pull/37918","author":"rogerdz","mergedAt":"2025-12-12T12:27:27Z","mergeCommit":"36783dff8ff9c2afca3cbed7a74c686976a8bb63","headCommit":"96ba350864ea39252a603732695f891ca4620ad7","baseRef":"2.4-develop","diffSha256":"2f20b03dbfc07556b35ef2e0a277d4e0226ad21622c8d1bed69c854c6ede7bac"},"issues":[{"number":37917,"url":"https://github.com/magento/magento2/issues/37917","title":"Refund with negative qty alway refund discound ","labels":["Area: Product","Component: Sales","Issue: Confirmed","Priority: P2","Progress: PR Created","Progress: PR in progress","Progress: done","Reported on 2.4.x","Reproduced on 2.4.x"],"kind":"human"}],"fixedIn":"2.4.9","containingTags":["2.4.9"],"reportedOn":null,"codeMatch":{"2.4.6":"clean","2.4.6-p1":"clean","2.4.6-p2":"clean","2.4.6-p3":"clean","2.4.6-p4":"clean","2.4.6-p5":"clean","2.4.6-p6":"clean","2.4.6-p7":"clean","2.4.6-p8":"clean","2.4.6-p9":"clean","2.4.6-p10":"clean","2.4.6-p11":"clean","2.4.6-p12":"clean","2.4.6-p13":"clean","2.4.6-p14":"clean","2.4.6-p15":"clean","2.4.7":"clean","2.4.7-p1":"clean","2.4.7-p2":"clean","2.4.7-p3":"clean","2.4.7-p4":"clean","2.4.7-p5":"clean","2.4.7-p6":"clean","2.4.7-p7":"clean","2.4.7-p8":"clean","2.4.7-p9":"clean","2.4.7-p10":"clean","2.4.8":"clean","2.4.8-p1":"clean","2.4.8-p2":"clean","2.4.8-p3":"clean","2.4.8-p4":"clean","2.4.8-p5":"clean","2.4.9":"conflict"},"affectedVersions":["2.4.6","2.4.6-p1","2.4.6-p2","2.4.6-p3","2.4.6-p4","2.4.6-p5","2.4.6-p6","2.4.6-p7","2.4.6-p8","2.4.6-p9","2.4.6-p10","2.4.6-p11","2.4.6-p12","2.4.6-p13","2.4.6-p14","2.4.6-p15","2.4.7","2.4.7-p1","2.4.7-p2","2.4.7-p3","2.4.7-p4","2.4.7-p5","2.4.7-p6","2.4.7-p7","2.4.7-p8","2.4.7-p9","2.4.7-p10","2.4.8","2.4.8-p1","2.4.8-p2","2.4.8-p3","2.4.8-p4","2.4.8-p5"],"components":["magento/module-sales"],"files":[{"path":"app/code/Magento/Sales/Controller/Adminhtml/Order/CreditmemoLoader.php","change":"modified","package":"magento/module-sales"}],"stripped":{"tests":["app/code/Magento/Sales/Test/Unit/Controller/Adminhtml/Order/CreditmemoLoaderTest.php"],"docs":[],"outsideCode":[]},"linesChanged":2,"mergeBatched":false,"excluded":null,"sections":{"description":"Refund discount\n![image](https://github.com/magento/magento2/assets/78783748/56443049-d1bf-4f14-9061-546670086733)","stepsToReproduce":"1. Create order with discount\n2. Create invoice for order\n3. Create credit memo with qty to refund negative","expectedResult":"Not refund discount same when Qty to Refund = 0\n![image](https://github.com/magento/magento2/assets/78783748/1f2c4f96-fe9c-4976-bc60-e2601cbb38cd)","actualResult":"Refund discount\n![image](https://github.com/magento/magento2/assets/78783748/56443049-d1bf-4f14-9061-546670086733)","source":"issue"},"signatures":[],"labels":{"area":["Product"],"component":["Sales"],"priority":"P2","severity":null,"reportedOn":["2.4.x"]},"categories":["Order/Checkout"],"triage":{"model":"@cf/cloudflare/clef","requestHash":"9b365d5cf115d03be2c57153ec80e0d7b95928c747d2f0bb04d92190159930db","isBugfix":0.9732,"changeKind":{"choice":"bugfix","probabilities":{"bugfix":0.9647,"feature":0.004,"refactor":0.0126,"tests_only":0.0114,"docs_only":0.0035,"dependency":0.0038},"confidence":0.9172},"scope":{"score":0.4528,"probabilities":{"0":0.6449,"1":0.2574,"2":0.0977},"confidence":0.2375},"risk":{"score":0.5326,"probabilities":{"0":0.6738,"1":0.1198,"2":0.2064},"confidence":0.2664},"area":{"choice":"admin","probabilities":{"catalog":0.023,"checkout":0.3333,"customer":0.0135,"admin":0.5558,"graphql_api":0.0126,"framework":0.0195,"frontend":0.0127,"other":0.0296},"confidence":0.3398},"securityRelevant":0.0077,"reportedVersion":{"choice":"unspecified","probabilities":{"2.4.0":0.0092,"2.4.0-p1":0.0051,"2.4.1":0.0032,"2.4.1-p1":0.0028,"2.4.2":0.0039,"2.4.2-p1":0.0033,"2.4.2-p2":0.004,"2.4.3":0.0065,"2.4.3-p1":0.0061,"2.4.3-p2":0.0059,"2.4.3-p3":0.0042,"2.4.4":0.0071,"2.4.4-p1":0.0051,"2.4.4-p10":0.0043,"2.4.4-p11":0.006,"2.4.4-p12":0.0047,"2.4.4-p13":0.0045,"2.4.4-p14":0.0048,"2.4.4-p15":0.0041,"2.4.4-p16":0.0045,"2.4.4-p17":0.0039,"2.4.4-p18":0.004,"2.4.4-p2":0.0024,"2.4.4-p3":0.0025,"2.4.4-p4":0.0026,"2.4.4-p5":0.0032,"2.4.4-p6":0.003,"2.4.4-p7":0.0037,"2.4.4-p8":0.0031,"2.4.4-p9":0.0028,"2.4.5":0.007,"2.4.5-p1":0.0059,"2.4.5-p10":0.0047,"2.4.5-p11":0.007,"2.4.5-p12":0.0068,"2.4.5-p13":0.0055,"2.4.5-p14":0.0069,"2.4.5-p15":0.0044,"2.4.5-p16":0.0043,"2.4.5-p17":0.0049,"2.4.5-p2":0.0027,"2.4.5-p3":0.0035,"2.4.5-p4":0.0035,"2.4.5-p5":0.0033,"2.4.5-p6":0.004,"2.4.5-p7":0.0039,"2.4.5-p8":0.004,"2.4.5-p9":0.0029,"2.4.6":0.0119,"2.4.6-p1":0.0093,"2.4.6-p10":0.0068,"2.4.6-p11":0.0077,"2.4.6-p12":0.0065,"2.4.6-p13":0.0068,"2.4.6-p14":0.0063,"2.4.6-p15":0.0054,"2.4.6-p2":0.0037,"2.4.6-p3":0.0052,"2.4.6-p4":0.0062,"2.4.6-p5":0.0045,"2.4.6-p6":0.0049,"2.4.6-p7":0.0056,"2.4.6-p8":0.0045,"2.4.6-p9":0.0033,"2.4.7":0.0087,"2.4.7-p1":0.008,"2.4.7-p10":0.0069,"2.4.7-p2":0.0049,"2.4.7-p3":0.0071,"2.4.7-p4":0.0094,"2.4.7-p5":0.0077,"2.4.7-p6":0.012,"2.4.7-p7":0.0088,"2.4.7-p8":0.0064,"2.4.7-p9":0.0041,"2.4.8":0.0094,"2.4.8-p1":0.0091,"2.4.8-p2":0.009,"2.4.8-p3":0.0087,"2.4.8-p4":0.0087,"2.4.8-p5":0.0084,"2.4.9":0.0107,"unspecified":0.5377},"confidence":0.2835},"backportWorthy":{"score":1.5382,"probabilities":{"0":0.0882,"1":0.2854,"2":0.6264},"confidence":0.2224}},"curated":{"title":"Credit memo with a negative qty to refund will refund the order discount","description":"For an order with discount and an invoice, a credit memo with a negative qty to refund will refund the discount; with Qty to Refund = 0 it does not. The change in the Sales CreditmemoLoader::load sets the item qty to 0 when the qty is not > 0.","categories":["Order/Checkout"],"author":"claude-code/opus-5.5","date":"2026-10-06","reviewedBy":null},"tests":{"2.4.8-p5":{"before":"not-runnable","after":"error","adapted":false,"runAt":"2026-10-06T09:20:07.525Z","releaseCommit":"870a22c63d9d9b68fa3297962e2d5d5841115814","suites":{"unit":{"before":"not-runnable","after":"error","runAt":"2026-10-06T09:20:07.525Z"}}},"2.4.7-p10":{"before":"fail","after":"pass","adapted":false,"runAt":"2026-10-06T09:29:07.516Z","releaseCommit":"72561bf80652f57cc642a03e2c9a51d74a285b14","suites":{"unit":{"before":"fail","after":"pass","runAt":"2026-10-06T09:29:07.516Z"}}}}},"_documentation":"https://magento.watch/api","_description":"Upstream fix magento2-37918 details"}