Jump to content

Shipping costs per weight of each product


tadde0

Recommended Posts

Hi,

 

I need to customize the cart (maybe the carrier module, too) and I'm struggling to figure out how to do that. I hope someone can help.

 

Here's the problem: I have many voluminous products in my catalog, so I need to ship them in separate boxes. The carrier obviously calculates the shipping cost by the weight range of each product (they also have different shipping rates for different destinations).

I thought that PS could do that, so I set the prices for each weight range, but then I realized it uses the cart total weight instead, so the result is not the same.

 

As I looked for a solution in the forum, I found this old topic that seemed to work in older versions of PS:

http://www.prestashop.com/forums/topic/140687-shipping-costs-per-weight-of-each-product-not-cart-total/.

I'm using Prestashop 1.5.6.1.

 

Does anybody know how to solve this problem?

 

Thanks.

Link to comment
Share on other sites

  • 10 months later...

You will need to develop custom shipping module and use getPackageShippingCost() or getOrderShippingCost() method to calculate shipping cost for each product and get the total shipping cost

But I guess it will be better to use getPackageShippingCost() method, because this method already have a parameter (in the 3rd parameter) which containing all products data within the existing cart.
 

.

/*
 * @param object $cart An existing object cart
 * @param float $shipping_cost The previous shipping cost which has been calculated for the cart
 * @param array $products List of product concerned by the shipping
 */
public function getPackageShippingCost($cart, $shipping_cost, $products)
{
      // Do shipping calculation here
}

.


You can calculate shipping cost for each product according to its weight, but you can not use different shipping address for 1 object cart, because object cart can only hold 1 shipping address

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...