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


Shipping price by weight and product count 16 May 2017 15:13 #1

  • jaak69
  • jaak69's Avatar Topic Author

Joomla 3.7
VM 3.2.1
At moment I use free plugin.

For example Product A
  • Purchase Quantity Steps - 6 (one box)
  • unit weight - 1 kg
  • boxes on pallet - 20 (60 units of product A) - different for every product
Shipping rules:
  1. If count of products is less than 60 (at moment count of products not implemented yet) then shipping price should be calculated by weight and region. This part works OK
  2. If count of product A will exceed 60 then for shipping price should be offered price of full pallet (cheaper than calculated by weight and region). How can define rule for this situation

Shipping price by weight and product count 25 May 2017 17:40 #2

Dear Jaak69,
If I understand you correctly, you want to have different shipping cost calculations for each product. I.e. Product A has shipping costs depending on the quantity of product A, product B has shipping costs depending on quantity of Product B, etc. The total shipping costs should then be the aggregated costs.

Unfortunately, our plugin does not provide any simple way to do calculations at product-level. The only situation where it can work is if you have a limited number of products. You'll then have to handle each product separately (store the result in a custom variable) and add those variables up:
Variable=MyShipping; Value=0
Variable=MyShipping; evaluate_for_skus(Articles, "skuA")<60; Value=MyShipping+evaluate_for_skus(Weight, "skuA")*12.34
Variable=MyShipping; evaluate_for_skus(Articles, "skuA")>=60; Value=MyShipping+8.88
Variable=MyShipping; evaluate_for_skus(Articles, "skuB")<60; Value=MyShipping+evaluate_for_skus(Weight, "skuA")*23.45
Variable=MyShipping; evaluate_for_skus(Articles, "skuB")>=60; Value=MyShipping+7.77

As you can see, for each product, you'll have to explicitly check the threshold of 60 articles and then add the shipping cost for that product to the MyShipping variable. The numbers 12.34, 23.45, 8.88 etc. are fantasy numbers that you'll have to replace with your own shipping cost structure values, of course.

Best regards,

Shipping price by weight and product count 20 Jul 2017 13:46 #3

  • trickybug
  • trickybug's Avatar
Can such a code be used to create rules if shipping should be calculated due to articles from different categories?
Now my rules look like

Condition=contains_any(Categories, 2,3,4,5,23,35,26,27,28,29,30,31,32,33,34,36,37); Shipping=13+12*evaluate_for_categories(articles, 2,3,4,5,23,35,26,27,28,29,30,31,32,33,34,36,37)

I would need this rule to work for each 4 items from those categories.
I mean 1st item =25, 2nd=25+12, 3rd= 37+12, 4th= 49+12
and begining from 5th 61+25, 6th= 86+12...
beginning from 9th = x+25 and then (x+25)+12...

I'd need this this because each parcel containes 4 items
I tried to use rule sample from "Box with beer bottles" but it doesnt work

Thanks in advance

Shipping price by weight and product count 31 Jul 2017 21:54 #4

Dear Trickybug,
If I understand your description correctly, each first bottle after a full box of 4 (in mathematical term, each bottle that is 1 modulo 4, i.e. the 1st, 4th, 9th, 13th, etc.) costs 25 shipping costs while all other bottles cost 12 shipping costs. Or in other words, each bottle costs 12 and each box of up to four bottles costs an additional 13. The particular category of the bottles does not matter.

If this is the case, then you can use a rule like the following:
Variable=Bottles; Value=evaluate_for_categories(articles, evaluate_for_categories(articles, 2,3,4,5,23,35,26,27,28,29,30,31,32,33,34,36,37))
Variable=Boxes; Value=ceil(Bottles/4)
Bottles>0; Shipping=12*Bottles+13*Boxes

Calculating the number of boxes uses the ceil function to charge one full box even when only one bottle is contained in the last box. E.g. if bottles=5, then bottles/4 will be 1.25, which needs to be rounded UP to 2. Thus the ceil function to round up to the next full number.

Best regards,
  • Page:
  • 1