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


PO Ranges + Individual Ranges + Weight per order 04 Oct 2014 23:05 #1

  • gbrakos
  • gbrakos's Avatar Topic Author
Hello. I just yesterday purchased your plugin and I would like some
help. Thanks for your time in advance.

I want to implement the following shipping rule

#1 ALL ZIPs (between 00000-99999 and with TOTAL ORDER >=69 has 0 shipping
#2 ZIP between 54000-57999 and with TOTAL ORDER >=20 has 0 shipping
now considering below that we have TOTAL ORDER <69
and ZIP 54000-57999 has TOTAL ORDER <20
#3 ZIP between 54000-57999 with WEIGHT<=3 has 3.30$ per kg and every next kg +0.75
#4 ZIP between 28000-29999 with WEIGHT<=3 has 4.05$ per kg and every next kg +1.23
#5 ZIP 78010 (specific one) with WEIGHT<=3 has 5.26$ per kg and every next kg +1.85
#6 ZIP 72410 (specific one) with WEIGHT<=3 has 5.26$ per kg and every next kg +1.85

actually there around 15 zip ranges (like #3 and #4) with above thinking (3kg and extra 1kg)
and some over 100 specific ZIPS (like #5 #6) with same charge (3kg and extra 1kg)

So how could this be done ? So It will help me to do the rest

Thanks in advance for your time and valuable help

PO Ranges + Individual Ranges + Weight per order 07 Oct 2014 12:53 #2

Dear gbrakos,
I would use rules like:
Name=Free shipping above 69€; Amount>69; Shipping=0
Name=Free shippingn to certain zips; Amount>20; 54000<=ZIP<=57999; Shipping=0
Name=3.3 per 3kg + 0.75 per additional kg; 54000<=ZIP<=57999; Shipping=3.30+0.75*ceil(max(Weight-3,0))
Name=4.05 per 3kg + 1.23 per additional kg; 28000<=ZIP<=29999; Shipping=4.05+1.23*ceil(max(Weight-3,0))
Name=Individual ZIPs; ZIP in list(78010, 72410); Shipping=5.26+1.85*ceil(max(Weight-3,0))

This should give you a good idea how to write the remaining rules.

Regarding the calculation of the shipping costs, e.g. "Shipping=3.30+0.75*ceil(max(Weight-3,0))":
-) 3.30 is the fixed amount
-) Every kg above 3kg is 0.75
-) The nr of kg above 3kg is calculated as: Weight-3. However, for orders below 3kg we have to set this to 0, thus the max(Weight-3, 0). That max call ensures that we don't add anything for orders below 3kg. For orders above 3kg this is the same as Weight-3.
-) The ceil(...) function is needed to round the increment to kg. In particular, a weight of 3.5kg is 0.5kg above 3kg, but it should count as 1 full kg, so we have to round it up to the next full kg.

Of course, you can also write two rules (one for weight<3kg, one for weight>=3kg) instead of trying to combine them to one rule (where the formula is a bit harder to understand). But all you save in the formula is that one max(..., 0) call:
Name=below 3kg; 54000<=ZIP<=57999; Weight<=3; Shipping=3.30
Name=above 3kg; 54000<=ZIP<=57999; Weight>3;  Shipping=3.30+0.75*ceil(Weight-3)

Best regards,
  • Page:
  • 1