Skip to content

Conversation

@iandfox
Copy link

@iandfox iandfox commented Feb 18, 2016

This is a (potential) fix for issue #3465

Essentially, a small shipping weight is rounded down to 0 lbs, 0 oz by the USPS shipping module, which kicks back an error from USPS. According to the USPS pricing api docs, 10 digits are allowed to be passed to the ounces field.

This pull request changes the rounding precision to 10. This is not necessarily the best nor only way to fix this - I think there is an argument to be made that no rounding should be performed at all (there is no rounding performed on the FedEx shipping weight, for example). However, I wanted to err on the side of caution and merely change the precision of the round function rather than removing it entirely.

Reproducing the bug is simple:

  • Activate USPS shipping module (turning on debug mode and watching debug.log is also helpful)
  • Create a product whose weight is 0.0001 lbs.
  • (As a customer) add product to cart, checkout, watch the error get kicked back from USPS that there is no package weight.

USPS allows for decimals in ounce weight (specifically, they allow 10 digits). Remove the whole-number rounding from the ounce calculation.
@alena-marchenko
Copy link

Hi Ian,

Please use static property instead of hard coding, check and fix failed Travis builds.

@KrystynaKabannyk
Copy link

Hello @SharpenedSpoon, since we didn't get a response from you I'm closing the PR. If you will have additional information regarding this PR please feel free to reopen it again.

magento-engcom-team pushed a commit that referenced this pull request Nov 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants