-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Description
This issue is automatically created based on existing pull request: #40307: Commercial destination should not be treated as residential
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").
According to UPS API behavior, the mere presence of the ResidentialAddressIndicator tag (even with an empty value) makes the shipment be treated as residential, which results in “Demand Surcharge - Residential” being applied and higher rates being returned for commercial destinations.
This pull request updates the REST request payload builder so that:
ResidentialAddressIndicatoris only included when49_residential === "01"(residential).- For non-residential (e.g.
"02"commercial) requests, theResidentialAddressIndicatorfield is not added to the payload at all.
This aligns the REST implementation with the existing XML implementation, which already adds ResidentialAddressIndicator conditionally based on 49_residential.
Manual testing scenarios (*)
Scenario 1: Commercial destination should not be treated as residential
- Configure UPS shipping in Magento with valid UPS credentials and enable the REST API integration (US → US shipment).
- Create a quote/cart with:
- Origin in the US (e.g. Miami, FL 33127).
- Destination in the US with a commercial destination type (
49_residential = "02"). - A package weight of approximately 20.8 lbs.
- Request shipping rates (via storefront checkout or REST API).
- Before the fix:
- Inspect the UPS REST request (debug/logs):
ShipTo.Address.ResidentialAddressIndicatoris present with an empty value.
- UPS returns rates that include “Demand Surcharge - Residential is applied on Package 0” and higher total charges.
- Inspect the UPS REST request (debug/logs):
- After the fix:
- Inspect the UPS REST request again:
ShipTo.Addressdoes not contain theResidentialAddressIndicatorfield for49_residential = "02".
- UPS returns commercial rates (no “Demand Surcharge - Residential” message), and totals match expected commercial pricing.
- Inspect the UPS REST request again:
Scenario 2: Residential destination still behaves as residential
- Using the same configuration, create a quote/cart with a residential destination (
49_residential = "01"). - Request shipping rates.
- Verify that:
ShipTo.Address.ResidentialAddressIndicatoris present in the UPS REST request.- UPS returns rates that include residential surcharge (e.g. “Demand Surcharge - Residential is applied on Package 0”).
- Behavior matches previous residential handling and the XML-based UPS rates.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status