Shipping By Rules for WooCommerce

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


Need Insurance Help 15 Apr 2016 17:20 #1

  • crazycrafter
  • crazycrafter's Avatar Topic Author
I've found the rules to give the option to ship with or without insurance, I've added them and all I'm seeing is the without insurance. I'm not sure where I'm going wrong. Can someone help? I'm including the rules I'm using. Thanks!

Name=No Insurance; Amount<6.99; Shipping=4.95
Name=No Insurance; Amount 7.00<=Amount<24.99; Shipping=6.95
Name=No Insurance; Amount 25.00<=Amount<69.99; Shipping=8.95
Name=No Insurance; Amount 70.00<=Amount<124.99; Shipping=10.95
Name=incl. $2.50 insurance; Amount<6.99; Shipping=7.45
Name=incl. $2.50 insurance; Amount 7.00<=Amount<24.99; Shipping=9.45
Name=incl. $3.00 insurance; Amount 25.00<=Amount<69.99; Shipping=11.95
Name=incl. $3.00 insurance; Amount 70.00<=Amount<124.99; Shipping=13.95
Name=incl. $3.50 insurance; Amount 125.00<=Amount<200.00; Shipping=3.50
Name=incl. $4.50 insurance; Amount 200.01<=Amount<300.00; Shipping=4.50
Name=incl. $5.50 insurance; Amount 300.01<=Amount<400.00; Shipping=5.50
Name=incl. $6.75 insurance; Amount 400.01<=Amount<500.00; Shipping=6.75
Name=incl. $9.25 insurance; Amount 500.01<=Amount<600.00; Shipping=9.25
Name=Free Shipping above 125.00; 125<=Amount; 0
Name=Free Shipping with Coupon; Condition=contains_any(Coupons, "FREEFRI", "FREEFRI"); Shipping=0

Need Insurance Help 15 Apr 2016 22:37 #2

Dear crazycrafter,
To understand what's going on, I have to explain how the plugin evaluates the rules:
Basically, each shipping method is designed to return at most one shipping cost.
For each shipping method, it simply looks at the first rule, checks if all conditions are met and if they are, the shipping cost given is used for this method. No other rules of this method are then evaluated any more. If the conditions are not met, the second rule is evaluated. Again, if the conditions are met, the shipping cost is offered and all subsequent rules are ignored.

If you want the user to choose from two different shipping costs, you need to create two shipping methods in the shipping by rules plugin, one for the "No insurance" case and one for the insured shipping. Each of these two methods can give one shipping cost (a method can also not offer any shipping cost).
Another consequence of this evaluation is that the most restricted rules need to be first. In particular, the free shipping rules typically need to be at the very beginning.

So, you need to set up two different methods.
  • Method 1, named "No Insurance": One ruleset with these rules
    Name=Free Shipping with Coupon; Condition=contains_any(Coupons, "FREEFRI", "FREEFRI"); Shipping=0
    Amount<6.99; Shipping=4.95
    Amount 7.00<=Amount<24.99; Shipping=6.95
    Amount 25.00<=Amount<69.99; Shipping=8.95
    Amount 70.00<=Amount<124.99; Shipping=10.95
    Name=Free Shipping above 125.00; 125<=Amount; 0
  • Method 2, named "Insured Shipping": One ruleset with these rules
    Name=incl. $2.50 insurance; Amount<6.99; Shipping=7.45
    Name=incl. $2.50 insurance; 7.00<=Amount<24.99; Shipping=9.45
    Name=incl. $3.00 insurance; 25.00<=Amount<69.99; Shipping=11.95
    Name=incl. $3.00 insurance; 70.00<=Amount<124.99; Shipping=13.95
    Name=incl. $3.50 insurance; 125.00<=Amount<200.00; Shipping=3.50
    Name=incl. $4.50 insurance; 200.01<=Amount<300.00; Shipping=4.50
    Name=incl. $5.50 insurance; 300.01<=Amount<400.00; Shipping=5.50
    Name=incl. $6.75 insurance; 400.01<=Amount<500.00; Shipping=6.75
    Name=incl. $9.25 insurance; 500.01<=Amount<600.00; Shipping=9.25

Please notice that the displayed name for the shipping cost will be "Method name (rule name)" if a "Name=" is given in the matching rule and "Method name" if no rule name is given. In the "No insurance" method, I removed all Name= parts, because the name of the method is already "No Insurance" and you don't want any additional information in parentheses.
In the insured case, you want the "inc. $_.__ insurance" in parentheses, so there we need the Name=.

Best regards,

PS: I just noticed that you bounds on the Amount variable look strange. e.g. Amount<24.99 means that the Amount has to be strictly smaller than 24.99. If the Amount is 24.99 this condition will NOT be fulfilled. I think you rather mean Amount<25 or Amount<=24.99 (i.e. 24.99 is also allowed).
Similarly, e.g. an amount of 300$ will not offer any shipping cost, because Amount<300 is not true, and amount 300.01<=Amount is not true either.

Am I correct that the "incl. $3.50 insurance" case is meant to apply up to an amount of 200$ (including the case of an order amount of exactly 200$)? Then I would change the rules to:
Name=incl. $2.50 insurance; Amount<7; Shipping=7.45
Name=incl. $2.50 insurance; 7<=Amount<25; Shipping=9.45
Name=incl. $3.00 insurance; 25<=Amount<70; Shipping=11.95
Name=incl. $3.00 insurance; 70<=Amount<125; Shipping=13.95
Name=incl. $3.50 insurance; 125<=Amount<=200; Shipping=3.50
Name=incl. $4.50 insurance; 200<Amount<=300; Shipping=4.50
Name=incl. $5.50 insurance; 300<Amount<=400; Shipping=5.50
Name=incl. $6.75 insurance; 400<Amount<=500; Shipping=6.75
Name=incl. $9.25 insurance; 500<Amount<=600; Shipping=9.25

Need Insurance Help 16 Apr 2016 05:48 #3

  • crazycrafter
  • crazycrafter's Avatar Topic Author
WOW!! Thank you SO Very Very Very Much!! Your explanation was so perfect!! I was just adding everything as a Ruleset to the one Rule. I didn't know I could and should be making the separate Rules. That's probably why my international shipping isn't working either. Because I set it up as a ruleset and not a rule.

As for the amounts. Are you saying I need to add the <= to them? This is our shipping costs and I was trying to match what is here
0-6.99 = 4.95
7-24.99 = 6.95
25-69.99 = 8.95
70-124.9 = 10.95
125+ = FREE

Need Insurance Help 17 Apr 2016 00:31 #4

Dear Crazycrafter,
if you have shipping costs of 4.95 for 0-6.99, then the corresponding rule would be:
0<=Amount<7; Shipping=4.95
Note that Amount<7 means smaller, but NOT equal to 7. This is what you wrote as -6.99.

If you write Amount<6.99, this means smaller, but not equal to 6.99, which is not what you intend.

Best regards,
  • Page:
  • 1