Advanced Shipping by Rules for VirtueMart
Virtuemart 2 plugin to determine shipping costs according to general rules. The conditions are given as arithmetic expressions (inequalities and equalities), possibly involving many different properties of the order (weight, number of articles, postal code, coupon code, order amount, etc.).
Very complex shipping cost structures can be easily implemented as one shipping method by describing each by a simple rule with conditions. Shipping costs can be depending on:
-) Total amount of the order (with or without taxes)
-) Total weight of the order
-) Number of articles or different products in the order
-) Volume or minimal and maximal extensions of the products
-) Postal code of the delivery address
-) Coupon code
Each rule is described as a simple line of text with an easy structure (semicolons separate the parts of the rule). Some simple examples are
Name=Free Shipping; 100<=Amount; 0 Name=Domestic Small; Articles<5; Amount<100; Shipping=1.50 Name=Domestic Standard; Amount<100; Shipping=3.50
This set of rules describes three shipping costs: Orders of 100€ and more are free, otherwise orders with less than five articles have shipping costs of 1.5€, all others 3.50€.
Some more advanced rules for quite strange shipping cost structures are:
Name=Weight-dependent Shipping Cost; 10<Amount<50; Amount<100; Shipping=4*Weight Name=3€ base + 1€/article; Shipping=3+1*Articles Name=Average Weight below 1kg; weight/Articles<1; Shipping=5+10/Articles*Weight Name=Free Shipping; 100<=Amount; 0
All terms can contain arbitrary mathematical expressions of the standard operators (+, -, *, /, % and ^), basic functions (max,min,round,ceil,floor) as well as arbitrarily nested parentheses. The conditions can also include any comparison operator (<, <=, !=, ==, >=, >) and the OR operator.
The shipping cost can be given either with or without taxes included.
By adding a check for the coupon code in the rule, one can even create coupons that set a particular shipping cost. E.g.
Name=Free Shipping with Coupon; Coupon=="FREE_SHIPPING"; Shipping=0