{"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":"fb0f42fa4656f802dd2abb5ec34eb7c6cf3b98bec1139cce53f78163f1377fa1","isBugfix":0.9691,"changeKind":{"choice":"bugfix","probabilities":{"bugfix":0.9625,"feature":0.0057,"refactor":0.0093,"tests_only":0.0076,"docs_only":0.0026,"dependency":0.0028,"cleanup":0.0095},"confidence":0.9144},"scope":{"score":0.6175,"probabilities":{"0":0.4995,"1":0.3836,"2":0.1169},"confidence":0.1154},"risk":{"score":0.5258,"probabilities":{"0":0.6736,"1":0.1269,"2":0.1995},"confidence":0.2645},"area":{"choice":"checkout","probabilities":{"catalog":0.004,"checkout":0.9609,"customer":0.0043,"admin":0.0055,"graphql_api":0.0069,"framework":0.0058,"frontend":0.0044,"other":0.0082},"confidence":0.9127},"securityRelevant":0.0073,"reportedVersion":{"choice":"unspecified","probabilities":{"2.4.0":0.0044,"2.4.0-p1":0.0038,"2.4.1":0.0039,"2.4.1-p1":0.0032,"2.4.2":0.0055,"2.4.2-p1":0.0045,"2.4.2-p2":0.0057,"2.4.3":0.0087,"2.4.3-p1":0.0102,"2.4.3-p2":0.0089,"2.4.3-p3":0.006,"2.4.4":0.0125,"2.4.4-p1":0.008,"2.4.4-p10":0.0072,"2.4.4-p11":0.0079,"2.4.4-p12":0.0068,"2.4.4-p13":0.0067,"2.4.4-p14":0.0087,"2.4.4-p15":0.006,"2.4.4-p16":0.0084,"2.4.4-p17":0.0068,"2.4.4-p18":0.0056,"2.4.4-p2":0.003,"2.4.4-p3":0.0033,"2.4.4-p4":0.0037,"2.4.4-p5":0.0042,"2.4.4-p6":0.0043,"2.4.4-p7":0.0049,"2.4.4-p8":0.0045,"2.4.4-p9":0.0042,"2.4.5":0.0152,"2.4.5-p1":0.0102,"2.4.5-p10":0.0073,"2.4.5-p11":0.0106,"2.4.5-p12":0.0091,"2.4.5-p13":0.0077,"2.4.5-p14":0.0083,"2.4.5-p15":0.0073,"2.4.5-p16":0.0082,"2.4.5-p17":0.0079,"2.4.5-p2":0.0032,"2.4.5-p3":0.0056,"2.4.5-p4":0.0065,"2.4.5-p5":0.0046,"2.4.5-p6":0.0052,"2.4.5-p7":0.0063,"2.4.5-p8":0.0067,"2.4.5-p9":0.0044,"2.4.6":0.0343,"2.4.6-p1":0.0197,"2.4.6-p10":0.0103,"2.4.6-p11":0.0142,"2.4.6-p12":0.0127,"2.4.6-p13":0.0126,"2.4.6-p14":0.0121,"2.4.6-p15":0.0099,"2.4.6-p2":0.0055,"2.4.6-p3":0.0099,"2.4.6-p4":0.0106,"2.4.6-p5":0.0088,"2.4.6-p6":0.0102,"2.4.6-p7":0.0089,"2.4.6-p8":0.0073,"2.4.6-p9":0.007,"2.4.7":0.0261,"2.4.7-p1":0.0156,"2.4.7-p10":0.0107,"2.4.7-p2":0.0089,"2.4.7-p3":0.0149,"2.4.7-p4":0.0162,"2.4.7-p5":0.0131,"2.4.7-p6":0.016,"2.4.7-p7":0.0135,"2.4.7-p8":0.0104,"2.4.7-p9":0.008,"2.4.8":0.0266,"2.4.8-p1":0.0201,"2.4.8-p2":0.0214,"2.4.8-p3":0.019,"2.4.8-p4":0.0172,"2.4.8-p5":0.0161,"2.4.9":0.0239,"unspecified":0.1925},"confidence":0.0363},"backportWorthy":{"score":1.7102,"probabilities":{"0":0.047,"1":0.1957,"2":0.7573},"confidence":0.4209}},"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"}