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


Rules by incremental weight as well as size 19 Sep 2014 14:22 #1

  • sarah.stewart
  • sarah.stewart's Avatar Topic Author
Hi there,

I wonder if you can help. I have tried various ways of writing rules to achieve the following (sounds so simple but I have not managed it so far!):

If the total cart weight is less than 20KG, shipping is always £7.50
For every KG over 20KG, an extra £0.25 is charged.
If any product in cart exceeds 1.6 metres in length, an extra £3.00 is charged as an addition to the weight

Is this possible?

Thanks very much in advance.
Sarah Stewart

Rules by incremental weight as well as size 19 Sep 2014 23:30 #2

Actually, this shipping cost structure is not too hard to implement in the advanced version of the plugin:
Variable=AddOn; Value=0
Variable=AddOn; MaxLength>1.6; Value=3
Name="Weight below 20kg"; weight<20; Shipping=7.50 + AddOn
Name="Weight above 20kg"; weight>=20; Shipping=7.50 + ceil(Weight-20)*0.25 + AddOn

The key trick here is to handle the addition to the weight as a custom variable. First you initialize it to zero (first line), and if the MaxLength is larger than 1.6, then you set it to 3 (second line). In the actual rules (one for weights below 20kg, one for above), you simply add that variable to the shipping costs.

Alternatively, you can use four rules without any helper variable:
Name="Weight below 20kg, length below 1.6m"; weight<20; MaxLength<=1.6; Shipping=7.50
Name="Weight below 20kg, length above 1.6m"; weight<20; MaxLength>1.6; Shipping=10.50
Name="Weight above 20kg, length below 1.6m"; weight>=20; MaxLength<=1.6; Shipping=7.50 + ceil(Weight-20)*0.25
Name="Weight above 20kg, length above 1.6m"; weight>=20; MaxLength>1.6; Shipping=10.50 + ceil(Weight-20)*0.25

Best regards,

PS: I have written these rule by heart without actually testing them. They are supposed to work, but I might have missed a typo or so. I think they should give you enough of an idea to solve your problem.

[SOLVED] Rules by incremental weight as well as size 23 Sep 2014 11:43 #3

  • sarah.stewart
  • sarah.stewart's Avatar Topic Author
Problem solved.
  • Page:
  • 1