{"data":{"id":"magento2-39103","source":"github-pr","sourceRef":"magento/magento2#39103","title":"Cart price rule created for logged in user incorrectly gets applied for not logged in user","pr":{"number":39103,"url":"https://github.com/magento/magento2/pull/39103","author":"rogerdz","mergedAt":"2024-12-13T16:06:45Z","mergeCommit":"bcc719fc9d73e52cb4c88959224e0b35c4e3fcdb","headCommit":"3943f79e335f17f7aa2a91b687198b38fd2f9aa6","baseRef":"2.4-develop","diffSha256":"a1733eaede78bb88aa209db3847272c2fb912c7b90935929b5160ae788fb1995"},"issues":[{"number":38944,"url":"https://github.com/magento/magento2/issues/38944","title":"Cart price rule created for logged in user incorrectly gets applied for not logged in user","labels":["Area: Cart & Checkout","Component: UiComponents","Issue: Confirmed","Priority: P1","Progress: done","Reported on 2.4.x","Reproduced on 2.4.x"],"kind":"human"}],"fixedIn":"2.4.8","containingTags":["2.4.8","2.4.8-p1","2.4.8-p2","2.4.8-p3","2.4.8-p4","2.4.8-p5","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":"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.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"],"components":["magento/module-persistent"],"files":[{"path":"app/code/Magento/Persistent/Observer/SetCheckoutSessionPersistentDataObserver.php","change":"modified","package":"magento/module-persistent"}],"stripped":{"tests":["app/code/Magento/Persistent/Test/Unit/Observer/SetCheckoutSessionPersistentDataObserverTest.php"],"docs":[],"outsideCode":[]},"linesChanged":60,"mergeBatched":false,"excluded":null,"sections":{"description":"Here user is logged out but still we can see the product in the cart and cart price rule is still applied.","stepsToReproduce":"1. In Marketing -> Cart Price Rules add rule for log in customers (select general customer group), for example 5% discount.(Shown in Screenshot - 1)\n3. In Stores -> Configuration ->Customers -> Persistent Shopping Cart -> set the following configuration: Enable Persistence - Yes , Clear Persistence on Sign Out – Yes (Shown in Screenshot - 2)\n4. In Stores -> Configuration -> General -> Web ->Default Cookie Settings ->Cookie Lifetime (For example 60 seconds) (Shown in Screenshot - 3)\n5. In the shop, create a customer account and add a product to the cart. At this time, the cart price rule will be applied, and the user will get a discount on the product.\n6. After that user will be log out according to the cookie lifetime (step – 3)\n7. Open the shop, at this time user is not log in into the shop, but user can still see the product into the cart with applied discount.(Shown in Screenshot - 4)","expectedResult":"When user is logged out cart price rule should not applied and cart should be empty.","actualResult":"Here user is logged out but still we can see the product in the cart and cart price rule is still applied.","source":"issue"},"signatures":[],"labels":{"area":["Cart & Checkout"],"component":["UiComponents"],"priority":"P1","severity":null,"reportedOn":["2.4.x"]},"categories":["Shopping Cart"],"triage":{"model":"@cf/cloudflare/clef","requestHash":"6202279ed00780e2832c5209d528e79b9172f34db12bebb93d5e06f9c1a61cfc","isBugfix":0.9822,"changeKind":{"choice":"bugfix","probabilities":{"bugfix":0.9683,"feature":0.0057,"refactor":0.0128,"tests_only":0.0062,"docs_only":0.0032,"dependency":0.0038},"confidence":0.9254},"scope":{"score":0.9634,"probabilities":{"0":0.2693,"1":0.498,"2":0.2327},"confidence":0.062},"risk":{"score":1.421,"probabilities":{"0":0.1893,"1":0.2005,"2":0.6102},"confidence":0.1726},"area":{"choice":"checkout","probabilities":{"catalog":0.0076,"checkout":0.8121,"customer":0.0945,"admin":0.0123,"graphql_api":0.004,"framework":0.0226,"frontend":0.0144,"other":0.0325},"confidence":0.6235},"securityRelevant":0.8245,"reportedVersion":{"choice":"unspecified","probabilities":{"2.4.0":0.005,"2.4.0-p1":0.0047,"2.4.1":0.0041,"2.4.1-p1":0.0036,"2.4.2":0.0043,"2.4.2-p1":0.004,"2.4.2-p2":0.0058,"2.4.3":0.008,"2.4.3-p1":0.0073,"2.4.3-p2":0.0082,"2.4.3-p3":0.0055,"2.4.4":0.0075,"2.4.4-p1":0.0061,"2.4.4-p10":0.0053,"2.4.4-p11":0.007,"2.4.4-p12":0.006,"2.4.4-p13":0.0062,"2.4.4-p14":0.0062,"2.4.4-p15":0.0054,"2.4.4-p16":0.0063,"2.4.4-p17":0.0056,"2.4.4-p18":0.0053,"2.4.4-p2":0.0033,"2.4.4-p3":0.0036,"2.4.4-p4":0.0037,"2.4.4-p5":0.004,"2.4.4-p6":0.0044,"2.4.4-p7":0.0044,"2.4.4-p8":0.0042,"2.4.4-p9":0.004,"2.4.5":0.0091,"2.4.5-p1":0.0092,"2.4.5-p10":0.0068,"2.4.5-p11":0.01,"2.4.5-p12":0.0097,"2.4.5-p13":0.0077,"2.4.5-p14":0.008,"2.4.5-p15":0.0068,"2.4.5-p16":0.0076,"2.4.5-p17":0.0079,"2.4.5-p2":0.0041,"2.4.5-p3":0.005,"2.4.5-p4":0.0055,"2.4.5-p5":0.0051,"2.4.5-p6":0.006,"2.4.5-p7":0.0062,"2.4.5-p8":0.0058,"2.4.5-p9":0.0047,"2.4.6":0.0126,"2.4.6-p1":0.0141,"2.4.6-p10":0.0107,"2.4.6-p11":0.0117,"2.4.6-p12":0.0099,"2.4.6-p13":0.0091,"2.4.6-p14":0.0102,"2.4.6-p15":0.0074,"2.4.6-p2":0.0052,"2.4.6-p3":0.0076,"2.4.6-p4":0.0091,"2.4.6-p5":0.0073,"2.4.6-p6":0.0081,"2.4.6-p7":0.0087,"2.4.6-p8":0.0059,"2.4.6-p9":0.0051,"2.4.7":0.0127,"2.4.7-p1":0.0113,"2.4.7-p10":0.0093,"2.4.7-p2":0.0085,"2.4.7-p3":0.0102,"2.4.7-p4":0.0159,"2.4.7-p5":0.0107,"2.4.7-p6":0.0127,"2.4.7-p7":0.0101,"2.4.7-p8":0.0079,"2.4.7-p9":0.0059,"2.4.8":0.0139,"2.4.8-p1":0.0132,"2.4.8-p2":0.0145,"2.4.8-p3":0.0137,"2.4.8-p4":0.0138,"2.4.8-p5":0.0115,"2.4.9":0.0145,"unspecified":0.3628},"confidence":0.1269},"backportWorthy":{"score":1.5524,"probabilities":{"0":0.0849,"1":0.2778,"2":0.6373},"confidence":0.2358}},"curated":{"title":"Fixes the issue where a logged-out customer keeps a login-only cart price rule","description":"With Enable Persistence and Clear Persistence on Sign Out set to Yes, a user logged out after the cookie lifetime still sees the product in the cart and the cart price rule is still applied. When the customer is not logged in and Clear Persistence on Sign Out is set, SetCheckoutSessionPersistentDataObserver now runs removePersistentCookie and sets the persistent session to null.","categories":["Shopping Cart"],"author":"claude-code/opus-5.5","date":"2026-10-06","reviewedBy":null},"tests":{"2.4.7-p10":{"before":"pass","after":"pass","adapted":false,"runAt":"2026-10-06T09:29:17.272Z","releaseCommit":"72561bf80652f57cc642a03e2c9a51d74a285b14","suites":{"unit":{"before":"pass","after":"pass","runAt":"2026-10-06T09:29:17.272Z"}}}}},"_documentation":"https://magento.watch/api","_description":"Upstream fix magento2-39103 details"}