New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UPS REST "A shipment cannot have a KGS/IN or LBS/CM or OZS/CM as its unit of measurements" #38618
Comments
Hi @sanmic. Thank you for your report.
Join Magento Community Engineering Slack and ask your questions in #github channel. |
@magento give me 2.4-develop instance - upcoming 2.4.x release |
Hi @sanmic. Thank you for your request. I'm working on Magento instance for you. |
Hi @sanmic! 👋 |
Hi @sanmic, here is your Magento Instance: https://b2437ad179063c5f7eb8a7bbdd57dc08.instances-prod.magento-community.engineering |
Hi @engcom-Dash. Thank you for working on this issue.
|
Hi @engcom-Delta. Thank you for working on this issue.
|
@magento give me 2.4-develop instance - upcoming 2.4.x release |
Hi @sanmic. Thank you for your request. I'm working on Magento instance for you. |
Hi @sanmic, here is your Magento Instance: https://b2437ad179063c5f7eb8a7bbdd57dc08.instances-prod.magento-community.engineering |
@engcom-Delta
How can I add a Add label to the ticket?
"Add Area: XXXXX label to the ticket, indicating the functional areas it may be related to."
|
Unfortunately, not enough information was provided to create a Jira ticket. Please make sure you added the following label(s): Once all required labels are present, please add |
Hi @sanmic, Our internal team is working on the issue and we have following updates Please refer the Comments: Thanks. |
@magento I am working on this |
Do we have some UPS access details to use to replicate the issue on a local environment? |
@digitalrisedorset Have you been able to get UPS access details? |
@sanmic no I have not. I got as far as creating the UPS account but a lot of settings were required and by the time I had the setup created to handle the task, I was doomed to have setup the UPS service differently to what is needed to replicate the issue we have in this ticket. So, I'd like instead to verify if I can use a test UPS environment that is ready to use to just perform the Magento test and fix after this |
@digitalrisedorset I guess I can create a UPS test app / credentials so you can continue your work. |
Hi @sanmic , I have setup a demo site at https://demo.digitalrisedorset.co.uk/ and the email may be herve@digitalrisedorset.co.uk. Many thanks |
@digitalrisedorset Check you email :) |
@sanmic .. we should be almost there. I have setup UPS, to start with, I'd like to verify I can get it to work as per the screenshots above, I have setup the credentials with European origin and yet Pounds rather than Kgs. I have also used an address from the states. I attach both screenshots. Am I missing something? I will start troubleshooting either way, thank you very much indeed |
@digitalrisedorset I think you have to set "Origin of the Shipment" to, for example, "Shipments Originating in United States". |
@sanmic I am not lucky just yet.. I have a successful response and in fact, some times for possible delivery time do appear. Unfortunately, it does return eventually the error message that UPS is not available. I will try to read more on UPS before debugging further. I apologise, it seems to be something that will take a while.
|
I have looked into UPS guides further. I have worked out that the setup can go wrong with the information: User ID, Password, Gateway URL and origin setting:
Could we double check these information settings before we go any further? #https://amasty.com/knowledge-base/how-to-set-up-ups-in-magento-2.html |
@digitalrisedorset I can confirm those settings work for me as long as I have LBS as weight unit. I've just spent a short time on this, but this is what I've found out so far.
UPS will NOT return rates if:
UPS will NOT return rates if:
I want to setup my store like this:
I can change line 1155 in /vendor/magento/module-ups/Model/Carrier.php -> "Code" => "CM", to make it work with above settings. |
I have a draft PR in place for this issue. The changes in the PR do resolve the problem but I'd like to check if we can also ensure that the integration can work with the other modes without being restricted to Inches before I finalise the PR see: #38673 |
@sanmic in the same way that Inch is hard-coded, I can see the dimensions for the request is also hard-coded. This is just below the place that you had patched:
I have changed the part you recommended us to change but I have not changed the dimensions. Would you be able to comment whether we should change it or not? |
@digitalrisedorset Yes, I've noticed that also. |
@sanmic the PR is now in review, I have tested today all the use cases you have mentioned and all is working with the simple changes added. |
@magento run all tests |
Preconditions and environment
Magento version 2.4.7
Steps to reproduce
Set European Union as Origin of the Shipment in Sales->Delivery Methods->UPS
Expected result
UPS rates is visible in checkout and cart.
Actual result
No UPS rates is visible in checkout and cart.
Additional information
Seems like UnitOfMeasurement is hardcoded to "IN".
If you have European Union (other origins may experience the same problem) as Origin of the Shipment this will cause an error in the UPS REST request:
"A shipment cannot have a KGS/IN or LBS/CM or OZS/CM as its unit of measurements"
1147 foreach ($rowRequest->getPackages() as $package) {
1148 $rateParams['RateRequest']['Shipment']['Package'][] = [
1149 "PackagingType" => [
1150 "Code" => "{$params['48_container']}",
1151 "Description" => "Packaging"
1152 ],
1153 "Dimensions" => [
1154 "UnitOfMeasurement" => [
1155 "Code" => "IN",
1156 "Description" => "Inches"
1157 ],
1158 "Length" => "5",
1159 "Width" => "5",
1160 "Height" => "5"
1161 ],
1162 "PackageWeight" => [
1163 "UnitOfMeasurement" => [
1164 "Code" => "{$rowRequest->getUnitMeasure()}"
1165 ],
1166 "Weight" => "{$this->_getCorrectWeight($package['weight'])}"
1167 ]
1168 ];
1169 }
Release note
No response
Triage and priority
The text was updated successfully, but these errors were encountered: