Skip to content
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

Add Volumetric Weight to Shipping Cost Calculation #3650

Open
sght500 opened this issue Sep 10, 2024 · 3 comments
Open

Add Volumetric Weight to Shipping Cost Calculation #3650

sght500 opened this issue Sep 10, 2024 · 3 comments

Comments

@sght500
Copy link

sght500 commented Sep 10, 2024

I’ve added a feature that calculates volumetric weight (length × width × height ÷ 5000) and compares it to the actual weight. The system now charges based on whichever is greater, following industry standards used by carriers. This ensures more accurate shipping costs, especially for bulkier packages. I believe this will improve cost accuracy and make the feature more reliable for users handling varied package sizes.

Please see the attached image with a snippet of the code change and a test of our new feature:

14  Added feature volumetric weight

@Ceay44
Copy link

Ceay44 commented Mar 4, 2025

Input package weight, volume dimensions, and shipping rate

weight = float(input("Enter the package weight in kilograms: "))
length = float(input("Enter the package length in centimeters: "))
width = float(input("Enter the package width in centimeters: "))
height = float(input("Enter the package height in centimeters: "))
rate = float(input("Enter the shipping rate per kilogram: "))

Calculate volumetric weight

volumetric_weight = (length * width * height) / 5000

Use the greater of the two weights

chargeable_weight = max(weight, volumetric_weight)

Calculate shipping cost

shipping_cost = chargeable_weight * rate

print(f"Shipping Cost: {shipping_cost:.2f} USD (Based on {chargeable_weight:.2f} kg)")

@sght500
Copy link
Author

sght500 commented Mar 8, 2025

Hi Ceay44,

Thank you so much for taking the time to respond to my issue from September! I really appreciate you looking into it and providing a potential solution.

It's great to see someone engaging with older issues. I'm glad this repository is still getting attention.

I hope your own learning journey with Git and GitHub is going well.

Thanks again!

sght500

@Ceay44
Copy link

Ceay44 commented Mar 9, 2025 via email

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

No branches or pull requests

2 participants