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


Setting condition to Not In List 15 Aug 2014 00:57 #1

  • ozthekeymaster
  • ozthekeymaster's Avatar Topic Author
Trying to give Free Shipping to orders over £50 but only if the UK state2 isn't in a certain list.

This works...
50<=Amount; state2 <> "AG"; state2 <> "BT" ; state2 <> "OR"; state2 <> "SL" ;state2 <> "AT" ;state2 <> "AM" ;state2 <> "DW" ;state2 <> "FE" ;state2 <> "LY" ;state2 <> "TY" ;Shipping=0

But this doesn't..
50<=Amount; not (state2 in list("AG", "BT", "OR", "SL", "AT", "AM", "DW", "FE", "LY", "TY")); Shipping=0

The opposite rule works fine (for adding a cost if they ARE in the list) i.e. 50<=Amount; state2 in list ("AG", "BT", "OR", "SL", "AT", "AM", "DW", "FE", "LY", "TY"); Shipping=13.95

Is there a way or writing a NOT IN LIST rule?


PS Love the extension by the way - one of the best I've seen and it's completely changed the way our shop can do shipping - thanks a million.

Setting condition to Not In List 18 Aug 2014 14:34 #2

You may try to place "Condition=" before the not(...) function call, because otherwise the plugin might not understand that rule part as a condition.

This is actually a small bug in the plugin: It is not always able to properly detect what part is a condition and what is the shipping costs. Currently, the (very simple) logic is that every rule part with a comparison operator ('<', '<=', '=<', '<>', '!=', '==', '>', '>=', '=>', '~', 'OR', 'AND', '&&', 'IN') is a condition, everything else is the shipping cost. In the early days of the plugin, this was true, but with the advent of functions, this no longer neccessarily holds.
To indicate a condition, you can always add "Condition=" (without the quotes) before the condition to make sure the plugin correctly understands that rule part as a condition.

Best regards,

PS: It is actually not trivial to come up with proper conditions when an experession is a condition and when it describes the shipping costs. I have not yet found the proper logic, so for now I'm sticking with the very limited (but predictable) way described above.

Setting condition to Not In List 18 Aug 2014 14:39 #3

Actually, I just checked the code, and your not(state2 in list(...)) is properly detected as a condition (because it contains the "in" operator).
I have also tried your rules in a test installation, and everything appear to work fine...

What exactly are your problems?
  • Page:
  • 1