{"data":{"id":"magento2-40307","source":"github-pr","sourceRef":"magento/magento2#40307","title":"Commercial destination should not be treated as residential","pr":{"number":40307,"url":"https://github.com/magento/magento2/pull/40307","author":"dmytrokaplin","mergedAt":"2026-01-16T11:20:14Z","mergeCommit":"414a50f827f145fcb5a8c5148ff80ce1acd1e826","headCommit":"0d3de781d2a00664bc0ac6e3ef06fb499318e9c9","baseRef":"2.4-develop","diffSha256":"4f981e792ff6bb310ff673ad2f8086e92a44732d4acaf858299f3100adbb7cf3"},"issues":[{"number":40314,"url":"https://github.com/magento/magento2/issues/40314","title":"[Issue] Commercial destination should not be treated as residential","labels":["Area: Shipping","Component: Ups","Issue: Confirmed","Priority: P2","Progress: done","Reported on 2.4.x","Reproduced on 2.4.x"],"kind":"pr-derived"}],"fixedIn":"2.4.9","containingTags":["2.4.9"],"reportedOn":null,"codeMatch":{"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.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.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-ups"],"files":[{"path":"app/code/Magento/Ups/Model/Carrier.php","change":"modified","package":"magento/module-ups"}],"stripped":{"tests":["dev/tests/integration/testsuite/Magento/Ups/Model/CarrierTest.php"],"docs":[],"outsideCode":[]},"linesChanged":8,"mergeBatched":false,"excluded":null,"sections":{"description":"The UPS REST rate request builder in `\\Magento\\Ups\\Model\\Carrier` always includes the `ResidentialAddressIndicator` field in the `ShipTo.Address` section, even when the destination type is commercial (`49_residential = \"02\"`).","stepsToReproduce":"#### Scenario 1: Commercial destination should not be treated as residential\n\n1. Configure UPS shipping in Magento with valid UPS credentials and enable the REST API integration (US → US shipment).\n2. Create a quote/cart with:\n   - Origin in the US (e.g. Miami, FL 33127).\n   - Destination in the US with a **commercial** destination type (`49_residential = \"02\"`).\n   - A package weight of approximately 20.8 lbs.\n3. Request shipping rates (via storefront checkout or REST API).\n4. **Before the fix**:\n   - Inspect the UPS REST request (debug/logs):\n     - `ShipTo.Address.ResidentialAddressIndicator` is present with an empty value.\n   - UPS returns rates that include “Demand Surcharge - Residential is applied on Package 0” and higher total charges.\n5. **After the fix**:\n   - Inspect the UPS REST request again:\n     - `ShipTo.Address` does **not** contain the `ResidentialAddressIndicator` field for `49_residential = \"02\"`.\n   - UPS returns commercial rates (no “Demand Surcharge - Residential” message), and totals match expected commercial pricing.\n\n#### Scenario 2: Residential destination still behaves as residential\n\n1. Using the same configuration, create a quote/cart with a **residential** destination (`49_residential = \"01\"`).\n2. Request shipping rates.\n3. Verify that:\n   - `ShipTo.Address.ResidentialAddressIndicator` **is present** in the UPS REST request.\n   - UPS returns rates that include residential surcharge (e.g. “Demand Surcharge - Residential is applied on Package 0”).\n   - Behavior matches previous residential handling and the XML-based UPS rates.\n\n### Resolved issues:\n1. [x] resolves magento/magento2#40314: Commercial destination should not be treated as residential","expectedResult":null,"actualResult":null,"source":"pr"},"signatures":[],"labels":{"area":["Shipping"],"component":["Ups"],"priority":"P2","severity":null,"reportedOn":["2.4.x"]},"categories":["Shipping"],"triage":{"model":"@cf/cloudflare/clef","requestHash":"e8a21970381d21da39a360d3e9ed47873440d84cbf1dbd3f084b0184f3b68064","isBugfix":0.9706,"changeKind":{"choice":"bugfix","probabilities":{"bugfix":0.9704,"feature":0.0065,"refactor":0.0103,"tests_only":0.0068,"docs_only":0.0028,"dependency":0.0032},"confidence":0.9303},"scope":{"score":0.6619,"probabilities":{"0":0.4534,"1":0.4314,"2":0.1152},"confidence":0.1074},"risk":{"score":0.4883,"probabilities":{"0":0.6904,"1":0.1309,"2":0.1787},"confidence":0.2885},"area":{"choice":"checkout","probabilities":{"catalog":0.0042,"checkout":0.9592,"customer":0.0045,"admin":0.0058,"graphql_api":0.007,"framework":0.0058,"frontend":0.0047,"other":0.0088},"confidence":0.909},"securityRelevant":0.0069,"reportedVersion":{"choice":"unspecified","probabilities":{"2.4.0":0.0038,"2.4.0-p1":0.0035,"2.4.1":0.0034,"2.4.1-p1":0.0029,"2.4.2":0.0051,"2.4.2-p1":0.0043,"2.4.2-p2":0.0053,"2.4.3":0.0084,"2.4.3-p1":0.009,"2.4.3-p2":0.0076,"2.4.3-p3":0.0054,"2.4.4":0.0108,"2.4.4-p1":0.0074,"2.4.4-p10":0.0063,"2.4.4-p11":0.0071,"2.4.4-p12":0.0063,"2.4.4-p13":0.0058,"2.4.4-p14":0.0076,"2.4.4-p15":0.0056,"2.4.4-p16":0.0076,"2.4.4-p17":0.006,"2.4.4-p18":0.0049,"2.4.4-p2":0.0029,"2.4.4-p3":0.0033,"2.4.4-p4":0.0034,"2.4.4-p5":0.0037,"2.4.4-p6":0.0041,"2.4.4-p7":0.0043,"2.4.4-p8":0.0047,"2.4.4-p9":0.0038,"2.4.5":0.0143,"2.4.5-p1":0.0105,"2.4.5-p10":0.0076,"2.4.5-p11":0.0106,"2.4.5-p12":0.0086,"2.4.5-p13":0.0078,"2.4.5-p14":0.0084,"2.4.5-p15":0.0074,"2.4.5-p16":0.008,"2.4.5-p17":0.0078,"2.4.5-p2":0.0034,"2.4.5-p3":0.0058,"2.4.5-p4":0.0061,"2.4.5-p5":0.005,"2.4.5-p6":0.0055,"2.4.5-p7":0.0061,"2.4.5-p8":0.0063,"2.4.5-p9":0.0044,"2.4.6":0.0319,"2.4.6-p1":0.0189,"2.4.6-p10":0.0104,"2.4.6-p11":0.0127,"2.4.6-p12":0.0127,"2.4.6-p13":0.0132,"2.4.6-p14":0.0113,"2.4.6-p15":0.0109,"2.4.6-p2":0.0052,"2.4.6-p3":0.0093,"2.4.6-p4":0.0097,"2.4.6-p5":0.0081,"2.4.6-p6":0.0087,"2.4.6-p7":0.008,"2.4.6-p8":0.007,"2.4.6-p9":0.0068,"2.4.7":0.0224,"2.4.7-p1":0.0141,"2.4.7-p10":0.0115,"2.4.7-p2":0.0084,"2.4.7-p3":0.014,"2.4.7-p4":0.0149,"2.4.7-p5":0.0125,"2.4.7-p6":0.0147,"2.4.7-p7":0.0134,"2.4.7-p8":0.0105,"2.4.7-p9":0.0078,"2.4.8":0.0252,"2.4.8-p1":0.0193,"2.4.8-p2":0.0197,"2.4.8-p3":0.0184,"2.4.8-p4":0.0163,"2.4.8-p5":0.015,"2.4.9":0.0189,"unspecified":0.2403},"confidence":0.0558},"backportWorthy":{"score":1.6956,"probabilities":{"0":0.0503,"1":0.2039,"2":0.7458},"confidence":0.4006}},"curated":{"title":"Fixes UPS REST rate requests treating commercial destinations as residential","description":"The UPS REST rate request builder always includes the ResidentialAddressIndicator field in the ShipTo.Address section, even for a commercial destination, so Demand Surcharge - Residential is applied and higher rates are returned. The field is now only included when 49_residential is 01.","categories":["Shipping"],"author":"claude-code/opus-5.5","date":"2026-10-06","reviewedBy":null},"tests":{"2.4.8-p5":{"before":"pass","after":"pass","adapted":false,"runAt":"2026-10-06T09:32:15.243Z","releaseCommit":"870a22c63d9d9b68fa3297962e2d5d5841115814","suites":{"integration":{"before":"pass","after":"pass","runAt":"2026-10-06T09:32:15.243Z"}}},"2.4.7-p10":{"before":"pass","after":"pass","adapted":false,"runAt":"2026-10-06T09:57:40.929Z","releaseCommit":"72561bf80652f57cc642a03e2c9a51d74a285b14","suites":{"integration":{"before":"pass","after":"pass","runAt":"2026-10-06T09:57:40.929Z"}}}}},"_documentation":"https://magento.watch/api","_description":"Upstream fix magento2-40307 details"}