VirtueMart

WooCommerce

Others

Docs

Support

Demo

Blog

About

Forum
Welcome, Guest
Username: Password: Remember me

TOPIC: Products with diferent shipping costs

Products with diferent shipping costs 11 Dec 2015 16:11 #1

Hi,

we have different kinds of products in our shop. Shipping costs for normal products would be handled by weight (€8,50 for the first 32kg, €8 for each 32kg more. But than we have big products who are shipped by cargo. They come in bundles. So if you order 1 or 2 products its one price, if you order 3 or 4 its another price, if you order 5 or 6 another price and so on.

I can not figure out how I can make the plugin calculate the prices depending on the amount of products in the one category and still add shipping costs for other products by weight.

Can you help me out or is this too complex for the plugin?

Regards,
Florian
The administrator has disabled public write access.

Products with diferent shipping costs 13 Dec 2015 13:40 #2

Dear Florian,
The shipping cost structure that you describe is not straightforward to implement in the plugin, but it is certainly possible. The logic is the following:
1. Calculate the number of big products (i.e. articles in category 1234) and the number of other products (total articles minus the number of big articles)
2. Calculate the weight of all other products (i.e. the total weight minus the weight of all products in category 1234)
3. If there are any weight based products, calculate the shipping for the weight-based shipping. This is done by rounding the other products' weight up to the next multiple of 32 and determining the multiple (i.e. 40,5kg will be rounded up to 64, which is 2*32, so the multipl is 64/32=2 and the weight based shipping is 0,5 + 8€*2). We have to add the check because your weight-base shipping cost is basically 0,5€ plus 8€ per 32kg.
4. The shipping cost is then the sum of the weight-based (using the weight of other products) and the quantity-based (using the number of big products) costs. The quantity-based shipping cost can be calculated similarly to the weight-based, except that we don't have to check for existence, since we don't have a fixed base amount like in the weight-based case.

Let's assume the big products are identified by category 1234 (if you have two or more such categories, you can add multiple categories to the evaluate_for_categories function). Also let's assume that each pair of big products costs 99€ to ship.
Variable=BigProducts; Value=evaluate_for_categories(Articles, 1234)
Variable=OtherProductsWeight; Value=Weight-evaluate_for_categories(Weight, 1234)
Variable=WeightBasedShipping; Value=0
Variable=WeightBasedShipping; OtherProductsWeight>0; Value=0.5+8*ceil(OtherProductsWeight, 32)/32
Shipping=WeightBasedShipping+99*ceil(BigProducts,2)/2

Best regards,
Reinhold
The administrator has disabled public write access.

VM - Shopping cart

 x 

Cart empty

Login Formular