{"data":{"id":"magento2-40872","source":"github-pr","sourceRef":"magento/magento2#40872","title":"Visual Swatch is deleted when updating option through REST API","pr":{"number":40872,"url":"https://github.com/magento/magento2/pull/40872","author":"aasim110","mergedAt":"2026-07-28T12:06:30Z","mergeCommit":"0c816c1af944b8dff21844fd95fda237946cf341","headCommit":"67caa994a018c56f7c35019bd55f5ddaacfda8dc","baseRef":"2.4-develop","diffSha256":"2fc9ffd049f8beb4d92cc0742fc1163fb55ff0e4d90d039b9558803602548ce5"},"issues":[{"number":37794,"url":"https://github.com/magento/magento2/issues/37794","title":"Visual Swatch is deleted when updating option through REST API","labels":["Area: APIs","Component: Attributes","Issue: Confirmed","Priority: P2","Progress: PR Created","Progress: done","Reported on 2.4.x","Reproduced on 2.4.x"],"kind":"human"}],"fixedIn":null,"containingTags":[],"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":"clean"},"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","2.4.9"],"components":["magento/module-swatches"],"files":[{"path":"app/code/Magento/Swatches/Plugin/Eav/Model/Entity/Attribute/OptionManagement.php","change":"modified","package":"magento/module-swatches"}],"stripped":{"tests":["app/code/Magento/Swatches/Test/Unit/Plugin/Eav/Model/Entity/Attribute/OptionManagementTest.php"],"docs":[],"outsideCode":[]},"linesChanged":5,"mergeBatched":true,"excluded":null,"sections":{"description":"Attribute labels are updated but swatch data is deleted","stepsToReproduce":"1. Make sure that you have an attribute with a visual swatch (in default example this is color)\n2. Update option value through REST API /rest/all/V1/products/attributes/[attribute_code]/options/[option_id] (for example to update translations)","expectedResult":"Attribute labels are updated and swatches remain as-is","actualResult":"Attribute labels are updated but swatch data is deleted","source":"issue"},"signatures":[],"labels":{"area":["APIs"],"component":["Attributes"],"priority":"P2","severity":null,"reportedOn":["2.4.x"]},"categories":["Catalog/Product","Web API"],"triage":{"model":"@cf/cloudflare/clef","requestHash":"bf56a385f245b833ceb82ceb83287e1383893fb49e3eff98b3430e479e094b7e","isBugfix":0.9834,"changeKind":{"choice":"bugfix","probabilities":{"bugfix":0.9682,"feature":0.0065,"refactor":0.0097,"tests_only":0.008,"docs_only":0.0036,"dependency":0.004},"confidence":0.9252},"scope":{"score":0.4804,"probabilities":{"0":0.6156,"1":0.2884,"2":0.096},"confidence":0.207},"risk":{"score":0.1926,"probabilities":{"0":0.835,"1":0.1374,"2":0.0276},"confidence":0.5753},"area":{"choice":"catalog","probabilities":{"catalog":0.6614,"checkout":0.0054,"customer":0.0047,"admin":0.049,"graphql_api":0.1978,"framework":0.0218,"frontend":0.03,"other":0.0299},"confidence":0.4073},"securityRelevant":0.0053,"reportedVersion":{"choice":"unspecified","probabilities":{"2.4.0":0.0095,"2.4.0-p1":0.0052,"2.4.1":0.0044,"2.4.1-p1":0.0035,"2.4.2":0.0054,"2.4.2-p1":0.0044,"2.4.2-p2":0.0075,"2.4.3":0.0117,"2.4.3-p1":0.0115,"2.4.3-p2":0.0116,"2.4.3-p3":0.0071,"2.4.4":0.013,"2.4.4-p1":0.0082,"2.4.4-p10":0.0056,"2.4.4-p11":0.0072,"2.4.4-p12":0.0059,"2.4.4-p13":0.0052,"2.4.4-p14":0.0069,"2.4.4-p15":0.0048,"2.4.4-p16":0.0059,"2.4.4-p17":0.0049,"2.4.4-p18":0.0044,"2.4.4-p2":0.0031,"2.4.4-p3":0.0033,"2.4.4-p4":0.0037,"2.4.4-p5":0.0042,"2.4.4-p6":0.0042,"2.4.4-p7":0.0048,"2.4.4-p8":0.0039,"2.4.4-p9":0.0034,"2.4.5":0.0096,"2.4.5-p1":0.0067,"2.4.5-p10":0.0052,"2.4.5-p11":0.0071,"2.4.5-p12":0.007,"2.4.5-p13":0.006,"2.4.5-p14":0.0072,"2.4.5-p15":0.0046,"2.4.5-p16":0.006,"2.4.5-p17":0.0054,"2.4.5-p2":0.0029,"2.4.5-p3":0.004,"2.4.5-p4":0.0045,"2.4.5-p5":0.0047,"2.4.5-p6":0.0048,"2.4.5-p7":0.0048,"2.4.5-p8":0.0042,"2.4.5-p9":0.0031,"2.4.6":0.0149,"2.4.6-p1":0.011,"2.4.6-p10":0.007,"2.4.6-p11":0.0094,"2.4.6-p12":0.0079,"2.4.6-p13":0.0074,"2.4.6-p14":0.0086,"2.4.6-p15":0.006,"2.4.6-p2":0.0037,"2.4.6-p3":0.0061,"2.4.6-p4":0.0086,"2.4.6-p5":0.0061,"2.4.6-p6":0.0069,"2.4.6-p7":0.0067,"2.4.6-p8":0.0045,"2.4.6-p9":0.0042,"2.4.7":0.0118,"2.4.7-p1":0.0103,"2.4.7-p10":0.0083,"2.4.7-p2":0.0073,"2.4.7-p3":0.0101,"2.4.7-p4":0.0153,"2.4.7-p5":0.0097,"2.4.7-p6":0.0122,"2.4.7-p7":0.0097,"2.4.7-p8":0.0072,"2.4.7-p9":0.0052,"2.4.8":0.0141,"2.4.8-p1":0.012,"2.4.8-p2":0.0149,"2.4.8-p3":0.014,"2.4.8-p4":0.014,"2.4.8-p5":0.0104,"2.4.9":0.0146,"unspecified":0.3977},"confidence":0.1533},"backportWorthy":{"score":1.6486,"probabilities":{"0":0.0683,"1":0.2148,"2":0.7169},"confidence":0.3471}},"curated":{"title":"Fixes swatch data being deleted when updating an attribute option through REST","description":"Updating an attribute option label or store translations through the REST API deletes the visual or textual swatch values. The Swatches OptionManagement plugin beforeUpdate() now does not set the swatch attribute option when the option value is empty or is the option ID, so the swatch configuration is not overwritten.","categories":["Catalog/Product","Web API"],"author":"claude-code/opus-5.5","date":"2026-10-06","reviewedBy":null},"tests":{"2.4.8-p5":{"before":"fail","after":"pass","adapted":false,"runAt":"2026-10-06T09:20:32.005Z","releaseCommit":"870a22c63d9d9b68fa3297962e2d5d5841115814","suites":{"unit":{"before":"fail","after":"pass","runAt":"2026-10-06T09:20:32.005Z"}}},"2.4.9":{"before":"fail","after":"pass","adapted":false,"runAt":"2026-10-06T09:20:33.384Z","releaseCommit":"755e34dd689021c5165db9d35ecff74f7dc51527","suites":{"unit":{"before":"fail","after":"pass","runAt":"2026-10-06T09:20:33.384Z"}}},"2.4.7-p10":{"before":"fail","after":"pass","adapted":false,"runAt":"2026-10-06T09:29:34.697Z","releaseCommit":"72561bf80652f57cc642a03e2c9a51d74a285b14","suites":{"unit":{"before":"fail","after":"pass","runAt":"2026-10-06T09:29:34.697Z"}}}}},"_documentation":"https://magento.watch/api","_description":"Upstream fix magento2-40872 details"}