Examples for "Shipping by Rules" for VirtueMart" and "Shipping by Rules for WooCommerce"
- Almost all of the examples given here are actual support requests we received, even though some sound really esoteric and unusual,
- The VirtueMart and the WooCommerce versions of our plugin are very similar, so all examples given here apply to both, unless explicitly noted.
- The Name=.... rule parts are optional and can be left out (they are only included in the shipment name, but do not influence the shipping cost itself)
- The shipping costs can be written without the leading Shipping= prefix.
- Also note that all variables are case-insensitive, so they can also be written in all lower-case.
- Most of the rules here can be written in more than one way.
- Unless explicitly mentioned, all examples will only consider one country set.v
- All examples for the free versions of the plugin can also be used in the advanced version.
Fixed, flatrate shipping of 5€ per order, no free shipping, no minimum etc.
Shipping=5
Fixed, flatrate shipping of 5€ per order, free shipping from 100€, no minimum etc.
Amount<100;Shipping=5
Name=Free shipping above 100€;100<=Amount;Shipping=0
Free shipping above 50€ order total
(FORUM) If one wants to offer free shipping under certain conditions, typically that free shipping rule needs to be placed FIRST:
Name=Free Shipping; 50<=Amount; 0.00 Name=Shipping to Sardegna oristano; 08010<=ZIP<09170; Shipping=5.88 Name=Shipping to Italy; Shipping=5.48;
Different shipping costs for various postal code ranges (only orders up to 10kg)
Name=Vienna; 1000<=ZIP<1999; weight<10; Shipping=10
Name=Lower Austria; 2000<=ZIP<3999; weight<10; Shipping=25
Name=Upper Austria; 4000<=ZIP<4999; weight<10; Shipping=30
Special shipping rates to German islands, flat rate to all other German areas
Name=Hiddensee; ZIP==18565; Shipping=10.084 Name=Pellworm; ZIP==25849; Shipping=10.084 Name=Hooge; ZIP==25859; Shipping=10.084 ... Name=Festland; Shipping=5.7983
First article 3€, each additional article 1€, free shipping for 5 or more articles (see also advanced below)
articles==1; Shipping=3
articles==2; 4
articles==3; 5
articles==4; 6
articles>=5; Shipping=0
Condition on the maximum length/width (e.g. because a different kind of truck needs to be used for delivery)
Name=Delivery by Van; MaxLength<200; MaxWidth<100; Shipping=25
Name=Delivery by Truck; MaxLength>=200; Shipping=75 Name=Delivery by Truck; MaxWidth>=100; Shipping=75
Net Shipping cost calculated from given gross shipping amount charged to the user (VirtueMart only)
When using ShipingWithTax instead of Shipping, the plugin will use the given amount as the total amount including taxes, which will be charged to the user. The tax amount and the net amount (without taxes) will be calculated automatically.
Name=Shipping cost given with taxes; Amount<100; ShippingWithTax=5
Different shipping costs to Hawaii and Alaska than to the rest of the USA
Simply distinguish Hawaii and Alaska from the mainland by conditions on the postal code. Remember, the first matching rule will be used, so the rest of the USA does not need a check for the ZIP code any more. In the advanced version, the two rules for Hawaii and Alaska can be merged using the OR operator.
Name=Shipping to Hawaii; 96700<=ZIP<96900; Shipping=8.95
Name=Shipping to Alaska; 99500<=ZIP; Shipping=8.95
Name=Shipping to rest of USA; Shipping=8.95
Rule name with special characters (semicolon, etc.)
The rule name typically can not contain a semicolon, as this is the separator of the different rule parts. However, by wrapping the name in quotes "...", one can still use it in the name. The rule name is always taken as a verbatim string, and cannot contain any HTML:
Name="A rule; condition is Amount<5"; Amount<5; Shipping=10
Handling some alphanumeric Post Codes
In the Netherlands, the postcode has the form 0000AA (i.e. four digits and two letters, where the two letters indicate the district and street). One can use the variables ZIP2 and ZIP4 (the first two and first four characters of the postcode) to write rules as one would do with any numeric post codes. Both rules yield the exact same result:
Name=Netherlands - Haarlem; ZIP2==20; Shipping=10
Name=Netherlands - Haarlem alternativ; 2000<=ZIP4<2999; Shipping=1
No shipping if certain conditions are met
By setting the shipping costs to NoShipping, the plugin will not check any more rules and will NOT offer any shipping at all. This can be used to exclude e.g. some islands or heavy packages from shipping:
Name=No shipping of heavy packages to a certain area; Weight>100; 8000<=ZIP<9000; NoShipping
Name=Flat rate otherwise; Shipping=15
Displaying the weight in the rule name
The available variables can also be displayed in the rule names by {varname}:
Name=Order of weight {weight}, {articles} articles of {products} products; Shipping=3
Require the customer to enter a postcode before shipping costs are shown
If no ZIP code was entered yet, the ZIP variable will behave as if a value of 0 was entered. So you can simply exclude shipping in this case:
Name=Please enter a valid ZIP to get a shipping rate; ZIP<=0; NoShipping Name=Real Shipping; 1000<=ZIP<1999; Shipping=1
Displaying the values of all variables for debugging purposes
Name=<pre>All variables: {Values_Debug}</pre>; NoShipping
Access AWO Coupon discounts (VirtueMart only)
(FORUM) For technical reasons (discounts from third-party plugins are evaluated AFTER shipping costs are calculated), discounts from AWO Coupon are not considered in the order total variables like Amount. If you need access to the AWO Coupon discounts, you can use our dedicated plugin to access these discounts.
Surcharge of 6€ for pizza deliveries made on a Saturday
Name=Surcharge for Saturday; Weekday==6; ExtraShippingCharge=6
Display a warning message when shipping is NOT possible
Error="Sorry, but we do not deliver Pizzas outside Vienna"; 2000<=ZIP<9999; NoShipping
Letting the customer choose between insured and uninsured shipping
It is not possible to have one rule set and then an additional checkbox for insurance. That is way beyond what shipping plugins can easily do.
However, you can create two shipping methods, one with and one without insurance. The rules for the shipping method with insurance would simply yield shipping costs that include the insurance, and its title you could include ("including insurance").
The user would then be given a choice like:
Shipping:
( ) Regular Shipping (no insurance): €7
( ) Insured Shipping (incl. €3 insurance): €10
The corresponding rules would be (I think you have a typo in your last line, so I'm assuming a price range of 2001-5000 for the 18€ shipping band):
Method 1 (named "Regular Shipping"): One ruleset with rules:
Name="No Insurance"; Amount<=1000; Shipping=7
Name="No Insurance"; 1000<Amount<=2000; Shipping=12
Name="No Insurance"; 2000<Amount<=5000; Shipping=18
Method 2 (named "Insured Shipping"): One ruleset with rules:
Name="incl. € 3 insurance"; Amount<=1000; Shipping=10
Name="incl. € 6 insurance"; 1000<Amount<=2000; Shipping=18
Name="incl. € 9 insurance"; 2000<Amount<=5000; Shipping=27
Shipping costs depending on the dimensions of the shipping box (VirtueMart only)
VirtueMart does NOT offer any way to calculate the actual dimensions of the shipping box. From a mathematical point of view, determining the optimal box dimensions for given product dimensions is a hard problem and far from trivial. Furthermore, it depends on which boxes the vendor has actually available. There is really no way to use the actual shipping box dimensions in VirtueMart's shipping rules. One can use TotalHeight, TotalWidth and TotalLength as absolute upper bounds (you need to add a few cm) for the box dimensions, but the more products are ordered, the worse this upper bound will be. Lower bound will of course be MaxHeight, MaxWidth and MaxLength, because the box needs to be as large as the largest items bought. See this forum post for further information.
Examples for "Advanced Shipping by Rules for VirtueMart" and for "Advanced Shipping by Rules for WooCommerce"
First article 3€, each additional article 1€ additional
Shipping=2+Articles
First unit of each product 3€, each additional copy 1€ additional
Shipping=2*Products+1*Articles
Weight-dependent shipping, 5€ per kg (calculated exactly)
Shipping=5*Weight
Weight-dependent shipping, 5€ per kg (partial kg count full, i.e. the weight is rounded up)
Starting from version 3.0 of the plugin, the ceil(..) function is available to round the weight up to the next full integer:
Shipping=5*ceil(Weight)
Weight-dependent shipping, different rates
Weight<5; Shipping=10*Weight
Weight<10; Shipping=8*Weight
Weight<15; Shipping=7*Weight
Name=Shipping of 15kg and above; Shipping=6*Weight
Weight-dependent shipping with weight bands
Consider a weight-based shipping cost structure with weight bands. For example, assume that the first 5kg will cost 5€/kg, the next 5kg will cost only 4€/kg, and everything above 10kg will cost 3€/kg. So an order with 7.5kg will cost 35€ (25€ for the first 5kg at 5€/kg, and 10€ for the remaining 2.5kg at 4€/kg), while an order of 20kg will cost 75€.
Such a cost structure can be expressed by the following rules:
Weight<5; 5*Weight
5<=Weight<10; (5*5)+4*(Weight-5)
10<=Weight; (5*5)+(4*5)+3*(Weight-10)
Of course, the cost for the last weight category can also be written as 45+3*(Weight-10) or 15+3*Weight, but that does not display the actual calculation structure.
Shipping costs per full kg
Some shipping structures calculate shipping costs either per full kg (e.g. the weight rounded down) or per started kg (the weight rounded up). Starting with version 3.0, the round(...), floor(...) and ceil(...) functions are available to round, round down or up:
o) Rounding down can be achieved as (e.g. floor(1.9) yields 1, floor(2.1) yields 2):
Shipping=floor(weight)
o) Rounding up (to the next integer value) can be achieved as:
Shipping=ceil(weight)
Free shipping if the average price per article is at least 5€
Name=Free shipping for average price above 5€; amount/articles >= 5; Shipping=0
Rule matching several postal code ranges
Notice that the OR operator is implemented only in the advanced version.
Name=Rule for several postcodes; 4000<=ZIP<=4229 OR 4300<=ZIP<=4307 OR 4500<=ZIP<=4575; Shipping=12.95
Offering USPS international shipping (condition on Length+2*(Width+Height) of the box) with erring on the safe side
The USPS apparently has an upper bound for international shipping. In particular, Length+2*(Width+Height) of the box needs to be below a certain threshold. Now, the plugin can not exactly determine how large your packaging box will be, but a nice upper bound can be obtained by simply stacking all products, one on top of each other (this ignores that you can usually put two or more products next to each other). The length of the resulting box will be MaxLength, the width will be MaxWidth, and the height will be TotalHeight. This is a crude upper bound, but if that upper bound already fulfills the condition, then the real box will fulfill them for sure. (On the other hand, if the upper bound does not fulfill the condition, you might still be able to optimize the packaging to fulfill the conditions, but the plugin cannot easily detect this. Mathematically, this is an optimization problem, and far from simple!)
Name=USPS upper bound fulfilled; MaxLength+2*(MaxWidth+TotalHeight)<80; Shipping=25
Checking whether a variable begins with a certain string or number
The ~ (tilde) operator checks wether the left and the right side coincide at the beginning (all characters of the shorter term need to be at the beginning of the longer term):
Name=ZIP starts with string CW1; ZIP~"CW1"; Shipping=10
Name=ZIP starts with numbers 123; ZIP~123; Shipping=1
Please note that for UK and Canadian postal codes, it is better to check the corresponding variables rather than ZIP. See below.
Canadian postal codes
For Canadian postal codes (alphanumeric), there are five dedicated variables available for the conditions: Canada_FSA, Canada_Area, Canada_Urban, Canada_Subarea and Canada_LDU.
Name=Free Shipping to British Columbia; Canada_Area=="V"; Shipping=0
Name=Chicoutimi (Quebec); Canada_Area=="G" AND Canada_Urban==7 AND "G"<=Canada_Subarea<="K"; Shipping=5
Name=Saint-Joseph-de-Coleraine; Canada_FSA=="G0N" AND Canada_LDU=="1B0"; Shipping=7
Please notice that in the third rule, the separate checks for FSA and LDU are better than a check for ZIP=="G0N 1B0", since it will also work if the user enters multiple spaces between the FSA and the LSU.
UK postal codes
For UK postal codes (alphanumeric of the form "A[A]0[0][A] 0AA") there are five dedicated variables available if a postal code of the appropriate format is detected: UK_Outward, UK_Area, UK_District, UK_Subdistrict and UK_Inward.
Name="Free shipping to Birmingham"; UK_Area=="B"; Shipping=0
Name="Free shipping to parts of Walsall"; UK_Area=="WS" AND 15<=UK_District; Shipping=0
Name=No Shipping to PO boxes in North London; UK_Outward=="N1P"; NoShipping
For British overseas territories, only the outward and the inward parts are assigned, while the area, district and subdistrict variables are empty.
Name="Free shipping to Gibraltar"; UK_Outward=="GX11" AND UK_Inward=="1AA"; Shipping=0
Name="No shipping to Falklands"; UK_Outward=="FIQQ"; NoShipping
Differentiate shipping by state (VirtueMart only)
You can use the Country, Country2, Country3, State, State2 and State3 variables to distinguish various countries in the country set and also the various states of the countries:
Name="Free shipping to California"; State2 == "CA"; Shipping=0
Name="Flat rate to some other states"; state2 in list("TX", "WS", "MS"); Shipping=5
Free shipping if a certain product is purchased
The SKUs variable (a list of all skus of the order) can be used to check whether a particular product is included in the order.
Name="Free shipping if product A is purchased"; "your-sku" in SKUs; Shipping=0
Shipping costs depending on categories in the cart
It is possible to make shipping costs depend on whether only products of a certain category or whether at least one product of a certain category are. The variable Categories provides a list of all categories of the products in the cart. You can use a condition "123 in Categories" to check whether the category with the ID 123 (see the virtuemart backend for the ID of your categories) is in the cart, and you can use the condition "Categories == list(123)" to check whether the category with ID 123 is the only category in the cart.
For example, if you want to prohibit shipping if a category is present, simply use the NoShipping indicator:
Name="Shipping not abroad not available for frozen items"; 1234 in Categories; NoShipping
If you want to provide free shipping if only items of category 1234 are in the cart (e.g. only downloadable items, or only course registrations, or only small items indicated by a certain category), you can use the following rule:
Name="Free shipping of Books only"; Categories==list(1234); Shipping=0
Starting with version 4.0 of the plugin, there are some more utility function to write conditions involving lists.
Shipping costs depending on products in the cart
Just like you can depend on the categories in the cart using the Categories variable (see above), one can depend on the individual articles in the cart by using the list variable SKUs:
Name=Free shipping if Product A is purchased (among others); "product-a" in SKUs; Shipping=0
NO Shipping if only one product from one category is ordered, 10€ otherwise
WooCommerce uses textual category SLUGs:
Condition=contains_any(Categories,"category-slug"); articles<=1; shipping=NoShipping
Shipping=10
VirtueMart uses numerical category IDs:
Condition=contains_any(Categories, 1234); articles<=1; shipping=noshipping
Shipping=9
Free shipping if at least 35€ from a category and its subcategories is ordered
Name="Free Shipping"; 35<=evaluate_for_subcategories(Amount, "stickers"); Shipping=0
Converting between different currencies (VirtueMart only)
A US-based shop (US$ as default currency) might want to check for an order to the EU whether the total USD-amount is larger than 23€. This is the threshold for paying import duties in Austria, so an order with a US$-amount equivalent to 23€ will incur higher bureaucracy and thus higher shipping costs.
Name="Above customs duty threshold"; convert_to_currency(Amount, "EUR")>23; Shipping=15
Name="No customs duty"; Shipping=3
Please note that in VirtueMart all price variables are always in the default currency, so one needs to convert them to other currencies if required.
Extra surcharge if 1-4 or more than 4 articles from certain categories are bought
Name=Extra charge for 1-4 glass products; 1<=evaluate_for_categories(Articles, 1234, 9876)<=4; ExtraShippingCharge=100
Name=Extra charge for more than 4 glass products; 4<evaluate_for_categories(Articles, 1234, 9876); ExtraShippingCharge=200
Name=Light package; Weight<50; Shipping=3
Name=Heavy package; Weight>=50; Shipping=5
In this ruleset, the base shipping cost will always be 3€ or 5€ (depending on the weight), but if glass products are included, an extra 100€ or 200€ is charged.
Surcharge based on volumetric weight and real weight
(FORUM) Base shipping costs and surcharge are based on the larger value of the real weight and the volumetric weight (total volume of all products multiplied by a factor of 250 kg/m^). Base shipping costs depends on weight bands (i.e. fixed bounds on this weight), an extra surcharge of 0.05€/kg of this volumetric weight is added:
Variable=VolWeight; Value = Volume*250
Variable=UseWeight; Value = max(VolWeight, Weight) ExtraShippingCharge=0.05*ceil(UseWeight) Name=TNT Economy Express Zone 2; UseWeight<=5; Shipping=14.00 Name=TNT Economy Express Zone 2; 5<UseWeight<=6; Shipping=14.83 Name=TNT Economy Express Zone 2; 6<UseWeight<=7; Shipping=15.65
Refund taxes through reducing shipping by the tax amount
Name=Normal shipping reduced by taxes; Shipping=Max(0, 50-TaxAmount)
Please note that this might not be legal in some jurisdictions!
Allow Wine bottles only to be purchased in multiples of 12 (all products from the wine category)
Name="We sell wines only in packs of 12. Please order in multiples of 12 bottles."; evaluate_for_categories(Articles, 1234)%12 <> 0; NoShipping
Making shipping depend on custom fields (VirtueMart only)
Custom fields are not directly available in the plugin. Rather, one needs to develop a dedicated Joomla/VM plugin to access the custom fields. See the documentation, the corresponding plugin template and this forum entry or this forum entry.
Free shipping if the order contains a set of at least 4 identical products (i.e. a set of 4 tyres)
Name="Free shipping for 4 identical tyres"; evaluate_for_categories(MaxQuantity, 42)>=4; Shipping=0 ... (Your other rules when the customer buys less than 4 identical tyres)
Per-article shipping cost (limited number of articles in the shop)
(FORUM) The plugin is not designed to calculate shipping costs per item (different shipping cost for different products) purchased. In the case where the shop only has a very limited number of different products available, one can explicitly check the number of all products in the shop. In this example, we assume 19$ for the first item of each product and 5$ for each further copy of product "tcell3N" and 25$ + 3$/further item for product "tcell5N":
Variable=MyCost; Value=0 Variable=MyCost; "tcell3N" in SKUs; Value=MyCost+14+5*evaluate_for_skus(articles, "tcell3N") Variable=MyCost; "tcell5N" in SKUs; Value=MyCost+22+3*evaluate_for_skus(articles, "tcell5N") .... Shipping=MyCost
See also this forum post for explanations and other workarounds.
Another forum post that describes per-article shipping costs is here.
Shipping cost of 3$ for each mug and 0.75$ for each coaster (no other products sold)
(FORUM) Assuming that your shop only offers mugs and coasters, you can calculate shipping costs of 3$ for each mug and 0.75$ for each coaster as follows (VirtueMart syntax with numeric category IDs, WooCommerce users need to use the category SLUGs in the evaluate_for_categories functions):
Shipping=3*evaluate_for_categories(articles, 123)+0.75*evaluate_for_categories(articles, 456)
Lower shipping cost if only products from category 13 are bought, free shipping above 100$
(FORUM) Shipping costs should be 2.95$ if only products from category 13 (in VirtueMart; WooCommerce users use the category SLUG like "books"), otherwise 4.95$. Orders above 100$ get free shipping:
Amount>=100; Shipping=0 Comment="Only cat 13"; evaluate_for_categories(Articles, 13)==Articles; Shipping=2.95 Comment="All other orders are 4.95"; Shipping=4.95
Exclude all products from a certain category from shipping cost calculation (i.e. they get free shipping)
Store sells vouchers (category 1234) and other items. If a voucher is bought together with other articles, the voucher should be excluded from the shipping cost calculation (based on the number of items bought). If only vouchers are bought, postage is 1.50€.
The proper approach to this problem is to define a custom variable that holds the number of non-voucher items. All shipping costs are then calculated from that custom variable rather than the Articles variable (which includes the number of vouchers).
Variable=Vouchers; Value=evaluate_for_categories(Articles, 1234) Variable=OtherItems; Value=Articles-Vouchers Comment="Only vouchers"; Vouchers==Articles; Shipping=1.50 OtherItems<=3; Shipping=6.95 OtherItems<=11; Shipping=9.95 OtherItems>=12; Shipping=0
Products from Manufacturer 1 cost 10€ flat, from Manufacturer 2 cost 2€/kg (VirtueMart only) (FORUM)
Variable=CostManuf1; Value=0 Variable=CostManuf1; 1 in Manufacturers; Value=10 Variable=WeightManuf2; Value=evaluate_for_manufacturers(Weight, 2) Shipping=CostManuf1+2*WeightManuf2
2$ per article, except from category 249, which are free (FORUM)
Name="Free Shipping"; contains_only(categories, 249); Shipping=0 Variable=shippingArticles; Value=Articles - evaluate_for_categories(Articles, 249) Shipping=2*ShippingArticles
Products from one category (heavy products) get quantity-based costs, all other products get weight-based shipping costs (FORUM)
Variable=BigProducts; Value=evaluate_for_categories(Articles, 1234) Variable=OtherProductsWeight; Value=Weight-evaluate_for_categories(Weight, 1234) Variable=WeightBasedShipping; Value=0 Variable=WeightBasedShipping; OtherProductsWeight>0; Value=0.5+8*ceil(OtherProductsWeight, 32)/32 Shipping=WeightBasedShipping+99*ceil(BigProducts,2)/2
Items from category 23 cost 10€ flat, all other items are weight-based (FORUM)
23 in Categories; ExtraShippingCharge=10
Variable=MyWeight; Value=weight-evaluate_for_categories(Weight, 23)
[... your other rules, using MyWeight instead of weight...]
Free shipping up to 1000€ (excluding taxe), 6.5% of the order amount above (FORUM) (VirtueMart only)
Name=Free shipping up to 1000€; amountWithoutTax<=1000; Shipping=0 Name=6,5% shipping above 1000€; amountWithoutTax>1000; Shipping=0.065*amountWithoutTax
Require a minimum quantity of 5 (or none) from a certain category
Name="Catetory X has a minimum order quantity of 5"; 1<=evaluate_for_categories(Articles, 1234)<5; NoShipping
Vendor-dependent shipping costs (for Multi-Vendor shops)
(FORUM) Vendors in VirtueMart are identified by their numeric Vendor ID. In WooCommerce, one should use the vendor slug strings instead in the rules (in particular in "3 in vendors" and in evaluate_for_vendors):
Variable=vendor1cost; Value=0 Variable=vendor1cost; 3 in vendors; evaluate_for_vendors(Weight,3)<=200; Value=2 Variable=vendor2cost; Value=0 Variable=vendor2cost; 4 in vendors; evaluate_for_vendors(Weight,4)<=5000; Value=5 Shipping=vendor1cost+vendor2cost
Fixed (flat-rate, never free) shipping cost for certain ZIP codes, flat/free shipping (depending on amount) to all others
Name=Fixed shipping for some postal codes; ZIP in list(20100, 1120, 50020, 8052); Shipping=30 Amount<59.99;Shipping=6.56 Name=Spedizione gratis;59.99<=Amount;Shipping=0
Exclude all products of categories 114 and 109 from shipping to eastern Europe, except for one product (FORUM) (VirtueMart only)
Name=No shipping to xxx, except product A; Condition=not(contains_only(evaluate_for_categories(SKUs, 114, 109), "sku-a")); country2 in list("BG", "CY","EE", "GR", "LT", "LV", "RO", "RU", "SK", "SI", "TR"); NoShipping
To exclude shipping, there are two conditions: 1) the order is for eastern Europe and 2) there is a product from category 114 or 109 in the order, except product "sku-a".
The first condition is checked by the "country2 in list(...)" term. The second condition is a bit trickier. Our approach is to get all product SKUs for the articles ordered from these two categories and check that it is not only product "sku-a".
Handling light, but large items that require higher shipping costs
(FORUM) Some shops have articles that need to be handled specially, e.g. large or fragile items. If you need to inlude this information in the shipping cost calculation, the best way is to mark these special products with special (hidden) categories for VirtueMart shops and with a dedicated Shipping class for WooCommerce. One can then
Name="Low rate"; 1<=Weight<=100; 1<=Amount<=74.99; Condition=contains_none(Categories, 1234); Shipping=.... Name="Higher rater, category 1234 is in the cart"; 1<=Weight<=100; 1<=Amount<=74.99; Condition=contains_any(Categories, 1234); Shipping=....
For WooCommerce, one would use ShippingClasses instead of Categories, and the shipping class SLUGs instead of the numerical category ID.
Orders with products from only certain Manufacturers are free, one Manufacturer (8) has a minimum amount for free shipping (VirtueMart only)
Name=Free Delivery; Condition=contains_only(Manufacturers, 7,17,81); Shipping=0
Name=Free Delivery; Condition=contains_only(Manufacturers, 7,8,17,81); 3500<=evaluate_for_manufacturers(Amount, 8); Shipping=0
Shipping=15
Flat rate of 1$, except if certain categories are included
The shipping cost is 1$ flat, except (1) if products from categories 123, 124 or 125 are ordered, then it is 75$ or (2) otherwise if products from categories 150 or 151 are ordered, then shipping is 2 $/kg of the whole order:
Name=Flat rate (high); contains_any(Categories, 123, 124, 125); Shipping=75 Name=Standard rate (weight-based); contains_any(Categories, 150, 151); Shipping=Weight*2 Name=Flat rate (low); Shipping=1
Packaging beer bottles into boxes of 12/6/3 bottles with shipping costs of 8/4/2.55€
Variable=Bottles; Value=Articles-evaluate_for_categories(Articles, 1234)
Variable=Box12; Value=round(Bottles/12-0.0001)
Variable=Box6; Value=round((Bottles-12*Box12)/6-0.0001)
Variable=Box3; Value=ceil((Bottles-12*Box12-6*Box6)/3)
ExtraShippingCharge=8*Box12+4*Box6+2.55*Box3
The reason for the -0.0001 is that e.g. 18 bottles should be packed into one 12-pack and one 6-pack. without the -0.0001, the round would round UP to TWO 12-packs.
Special shipping rate to UK post codes "SN8 3E*", "SN8 3F*" and "SN8 3H*" (* means any letter)
The comparison operator == does NOT allow any wildcard in the strings. However, one can simply take the first two letters of the UK_Inward postal code part:
UK_outward=="SN8"; substring(UK_Inward, 0, 2) in list("3E", "3F", "3H"); shipping=123
If a product from category 10 or 13 is bought, then shipping on products from categories 11 and 12 is free; Shipping is weight-based
(FORUM) The approach is similar to the one described above how to exclude certain categories altogether. Here, we just have an additional condition to exclude certain categories.
Variable=WeightMod; Value=Weight Variable=WeightMod; Condition=contains_any(Categories, 10, 13); Value=Weight-evaluate_for_categories(Weight, 11, 12) Name="Shipping is 10€ per kg"; Shipping=10*ceil(WeightMod)
Orders above 100$ are 8% of the order total, but at least 15$
Amount>100; Shipping=max(15, 0.08*Amount)
Coupons for free shipping
VirtueMart (built-in coupon system, NOT AWO Coupon):
Name=Free Shipping with Coupon; Coupon=="ohs15"; Shipping=0
Name=Free Shipping with Coupon; Coupon=="ac72dHW8"; Shipping=0
WooCommerce:
Name=Free Shipping with Coupon; Condition=contains_any(Coupons, "ohs15", "ac72dHW8"); Shipping=0
Orders above 15kg are 8€ + 0.55€ per additional kg
Name=24/48H ; Weight<=10; Shipping=6.50
Name=24/48H ; 10<Weight<=15; Shipping=8
Name=24/48H ; 15<Weight<=100; Shipping=8+0.55*ceil(Weight-15)
Shipping is 6€ for the first six articles and 6€ for each further six article
Simply round up the number of article to the next multiple of 6:
Shipping=ceil(Articles, 6)
Different quantity-based shipping cost for different countries (VirtueMart only)
state2 in list("aa", "bb", "cc", "dd"); Shipping=8+ceil(Weight)*2
state2 in list("zz", "ee", "hh", "ff"); Shipping=13+ceil(Weight)*2
Some states have additional surcharge on the shipping costs (VIC +50%, SA +70%, WA +100%)
Name=VIC modifier; state=="VIC"; ExtraShippingMultiplier=1.50
Name=SA modifier; state=="SA"; ExtraShippingMultiplier=1.70
Name=WA modifier; state=="SA"; ExtraShippingMultiplier=2.0
Name=Standard shipping; Shipping=15*ceil(Weight)
Conditions on the post code for ZIP codes given in an external file
You will have to implement this as an extension plugin. For VirtueMart, see this forum post, for WooCommerce the approach is similar, just that one needs to connect to the opentools_shipping_by_rules_replacements($replacements) filter. Return value is an array with entries 'functionname'=>'php_function'.
Displaying some text in the rule name when an ExtraShippingCharge applies
(FORUM) It is currently not possible to display the name of an ExtraShippingCharge variable in the shipping name. However, as a workaround, one can define a variable under the same conditions as the extra shipping charge and include that in the rule name:
Name=Extra charge for Rope; ZIP>=8000; ExtraShippingCharge=15 Variable=ExtraChargeText; Value="" Variable=ExtraChargeText; ZIP>=8000; Value=" (extra charge to Islands)"
Name="Postal Service Light{ExtraChargeText}"; Weight<10; Shipping=10
Name="Postal Service Heavy{ExtraChargeText}"; 10<=Weight; Shipping=30