Shipping by Rules for VirtueMart

IMPORTANT ANNOUNCEMENT: Plugin development ceased, all plugins made available freely (GPL)

With great sadness we have to announce that we are ceasing development of all our VirtueMart, WooCommerce and Joomla plugins. Effective immediately, all our plugins -- even those that were paid downloads -- are made available for free from our homepage (GPL license still applies), but we cannot and will not provide any support anymore.

It has been a great pleasure to be part of the thriving development communities of VirtueMart as well as WooCommerce. However, during the last year it became painstakingly clear that in addition to a full-time job, a young family and several other time-consuming hobbies at professional level (like being a professional singer) the plugin development and the support that it requires is not sustainable and is taking its toll. It has been an honor, but it is now time to say good bye!



The forum is in read only mode.
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1


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

  • flowingweb
  • flowingweb's Avatar Topic Author

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?


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

Best regards,
  • Page:
  • 1