How to calculate the freight of various products


I'm developing a virtual store and I need to implement the freight calculation for the purchase, I managed to make this implementation but the problem is that with a single product in the cart I get the correct return, but with several products in the cart, the values do not beat with the logistics company simulator.

I wanted to know how I can calculate the freight of several products together. If I calculate the cube of each one separately and then I add all, or if I calculate the cube with the sum of the dimensions of the products, or what is the correct way to do it.

I am lost with regard to this calculation because not on the internet there is only content explaining about the calculation of individual products and I can not solve this question.

asked by anonymous 17.03.2014 / 20:11

2 answers


To make a calculation that hits the logistics company, you would have to do the same calculation that they do. Each company can be its own criteria:

  • weight only

  • dimension: width + height + depth not exceeding an established value (airline type: the sum of width + height + depth can not exceed 115 cm)

17.03.2014 / 20:33

The question goes beyond adding the dimensions and weights, the correct one is to define standard boxes and with the sum of the products to identify if they fit in it ...

Because if we just add the values, it can occur to exceed the limit allowed by the Post.

What can be done: Example: Box 1 (20 x 20 x 20), Box 2 (30 x 30 x 40) ........... when adding more than 1 product, its dimensions must be added and checked, OS PRODUCTS FALL IN BOX 1? ... THE PRODUCTS FALL IN BOX 2 ??, if the dimensions exceed the boxes registered, dismember the quotation ... you will have to quote products individually.

It may seem a little complicated, but it reduces the possibility of errors and always ends up gaining a little bit in the amount of freight.

05.11.2014 / 22:39