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


Problem with "evaluate_for_categories(Total,..)" 04 Dec 2016 18:36 #1

  • Silke01
  • Silke01's Avatar Topic Author
Hi Reinhold,

I have an urgent issue.
Since my shop has virtual and normal products (that are being shipped), I'd like to exclude the virtual products from the shipping calculations.

My 2 formulas are not that simple and look like this at the moment:
1. evaluate_for_categories(Total, not("virtual_product_category" in categories))=<80; contains_any(ShippingClasses, "normal_products", "virtual_products") AND contains_none(ShippingClasses, "heavy_products"); 7.00
2. condition=contains_only(ShippingClasses, "light_products", "virtual_products"); evaluate_for_categories(Total, not("virtual_product_category" in categories))=<80; Shipping=3.00

What these functions should lead to:
1. Calculate the total € amount of all products, that are not in the category "virtual_product_category" and check if it's below 80€. Check if the cart contains at least one with the shipping class "normal_products" and contains no product with the shipping class "heavy_products". If these criteria are met, offer 7€ shipping.
2. Check if there are only products with the shipping classes "light_products" and "virtual_products" in the cart. Calculate the total € amount of all products, that are not in the category "virtual_product_category" and check if it's below 80€. If these criteria are met, offer 3€ shipping.

Please Help!
With the above functions set, the shop is offering always 7€ shipping.
(Further Information: I have another "premium" shipping method set with the normal woocommerce setting, so there is always an alternative)

Kind regards

Problem with "evaluate_for_categories(Total,..)" 06 Dec 2016 20:44 #2

Dear Silke,
1) The order of the rules is relevant: The plugin will go through the rules sequentially and use the first rule where all conditions match. Since any cart that contains only virtual products also fulfills the condition of the first rule, the plugin will always offer the first rule for virtual products. You might need to add an additional rule for the case that only virtual products are purchased...
2) The evaluate_for_categories expects only category names as the second and all further arguments. In particular, you cannot give a negative condition on the categories. You can, however, simply use the order total and subtract the total restricted to those categories. Something like the following should work:a
condition=contains_only(ShippingClasses, "light_products", "virtual_products"); Total - evaluate_for_categories(Total, "virtual_product_category")=<80; Shipping=3.00
Total - evaluate_for_categories(Total, "virtual_product_category")=<80; contains_any(ShippingClasses, "normal_products", "virtual_products") AND contains_none(ShippingClasses, "heavy_products"); 7.00

Best regards,

[SOLVED] Problem with "evaluate_for_categories(Total,..)" 07 Dec 2016 16:05 #3

  • Silke01
  • Silke01's Avatar Topic Author
Thanks Reinhold! These formulas solved it!
  • Page:
  • 1