I am trying to setup UPS XML method for Shipping Rates, and it seems to work for any address in California. When I try an address outside of California, I do not get any shipping rates back.
So I looked at the Magento debug.log
and saw the below response. My assumption is that it is replacing the StateProvinceCode
for CA when its sending the request to UPS.
I looked at the following link https://github.com/magento/magento2/issues/6875 thinking the issue could be fixed, but its still ignoring the region in the Shipping Method.
'accessRequest' => '<?xml version="1.0"?>
<AccessRequest xml:lang="en-US">
<AccessLicenseNumber>XXXXXXXX</AccessLicenseNumber>
<UserId>****</UserId>
<Password>****</Password>
</AccessRequest>
',
'request' => '<?xml version="1.0"?>
<RatingServiceSelectionRequest xml:lang="en-US">
<Request>
<TransactionReference>
<CustomerContext>Rating and Service</CustomerContext>
<XpciVersion>1.0</XpciVersion>
</TransactionReference>
<RequestAction>Rate</RequestAction>
<RequestOption>Shop</RequestOption>
</Request>
<PickupType>
<Code>03</Code>
<Description>Customer Counter</Description>
</PickupType>
<Shipment> <Shipper> <Address>
<City></City>
<PostalCode>90034</PostalCode>
<CountryCode>US</CountryCode>
<StateProvinceCode>CA</StateProvinceCode>
</Address>
</Shipper>
<ShipTo>
<Address>
<PostalCode>28607</PostalCode>
<CountryCode>US</CountryCode>
<ResidentialAddress>01</ResidentialAddress>
<StateProvinceCode>CA</StateProvinceCode><ResidentialAddressIndicator>01</ResidentialAddressIndicator> </Address>
</ShipTo>
<ShipFrom>
<Address>
<PostalCode>90034</PostalCode>
<CountryCode>US</CountryCode>
<StateProvinceCode>CA</StateProvinceCode>
</Address>
</ShipFrom>
<Package>
<PackagingType><Code>00</Code></PackagingType>
<PackageWeight>
<UnitOfMeasurement><Code>LBS</Code></UnitOfMeasurement>
<Weight>8</Weight>
</PackageWeight>
</Package> </Shipment>
</RatingServiceSelectionRequest>',
'result' => '<?xml version="1.0"?>
<RatingServiceSelectionResponse><Response><TransactionReference><CustomerContext>Rating and Service</CustomerContext><XpciVersion>1.0</XpciVersion></TransactionReference><ResponseStatusCode>0</ResponseStatusCode><ResponseStatusDescription>Failure</ResponseStatusDescription><Error><ErrorSeverity>Hard</ErrorSeverity><ErrorCode>111285</ErrorCode><ErrorDescription>The postal code 28607 is invalid for CA United States.</ErrorDescription></Error></Response></RatingServiceSelectionResponse>
<City></City>
as it's required. So u need to override & Pass City then it worksmagento\vendor\magento\module-ups\Model\Carrier.php
Check forsetRequest
function weather it's settingcity
or not