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


Highest price need to be automatically chosen 26 Sep 2014 14:46 #1

  • Webdesign
  • Webdesign's Avatar Topic Author
I use Advanced Shipping by Rules Plugin.

I have several products in the webshop and i used this code

name=TNT Post; weight==1; shipping=2
name=TNT Pakket; weight==2; shipping=6.95
name=Longbow; weight==3; shipping=24.95

Works perfect, except bij submit another product with a different weight it has to pick the highest shipping costs.
And by submit the third product it chose the option 'collect at a place"

So which code i am missing now?

Highest price need to be automatically chosen 26 Sep 2014 22:18 #2

I don't think I quite understood your shipping costs... Do you only have products with full kg weights?
If a customer buys an order that weighs 1.5kg, what should the shipping costs be?
If the user buys an order of 5kg, what should the costs be?

Also, I don't quite understand where the option "collect at a place" comes from. Do you mean that if the customer buys a particular product, then TNT should not be available, but only Longbow and you want the customer to enter a pickup place? The latter cannot be done with my plugin at all. To be honest, I'm not aware of any shipping plugin for VM that provides this.

Best regards,

Highest price need to be automatically chosen 27 Sep 2014 15:19 #3

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

Okay, I understand it is not clear what I want. I will try to explain it better.
The webshop is for archery-products (more then 5000 pcs).
Some of the products can be send which will costs € 2.- / These products I gave the weightcode 1kg ;
so when people buys these the shipment-costs is € 2,-

Other products I gave the weight code 2kg and it will costs € 6.95 by shipment
And other products have weightcode 3kg and it will costs € 24,95 for shipment

So now what happens if people orders a product from the weightcode 1kg, the shipment for this product comes perfectly in the cart of € 2,00, but when they go back to the shop to order another product of for example shipmentcosts € 6,95 the shipment cost changes in the highest costs of €24,95, which has to be €6,95 instead.

This is one problem!

The next problem is that if they buy a third product the shipment is "collect at a place"
This shipment option I have made for the people who wants to pick it up from the shop personally.

I hope it is more understandable now.


Highest price need to be automatically chosen 04 Oct 2014 12:35 #4

Dear Marlies,
Thank you for those further explanations. If I understand you correctly, each product has a code (assigned as dummy weight) and the shipment costs of the order are calculated from the product with the highest code in the order.

Product A: Weight 1; 5 pieces ordered
Product B: Weight 3; 1 piece ordered
Product C: Weight 3; 15 pieces ordered

In this case, the shipping cost is for category 3, and the quantities of the products is irrelevant for the calculation of the shipping costs.

To solve this, you can simply use the MaxWeight variable rather than Weight (which gives the sum of all dummy weight values).
In my example, MaxWeight will have a value of 3 and thus result in 24,95€ shipping, while in your original example, the second product will have weight code 2 (which is the maximum of 1 and 2), so the shipping will be 6,95€.

The rather straightforward rules in this case are:
Name=Shipping class 1; MaxWeight<=1; Shipping=2
Name=Shipping class 2; MaxWeight<=2; Shipping=6.95
Name=Shipping class 3; MaxWeight<=3; Shipping=24.95

Your issue with "collect at our shop" is ideally solved with two shipping methods: One method that offers "Collect at your shop" with 0 shipping costs. That method can either use my plugin, or even the standard shipping module included in VM. And then you have the "Shipping by Rules"-based method as given above, with just an additional, prepended rule that excludes all orders with that particular product from shipping at all. How do you identify that product / those products? You can either use a particular category, or you can identify individual products by their sku.

Excluding by SKU (here, two products with SKU "excluded-SKU1" and "excluded-SKU2" are excluded from shipping at all):
Comment=No shipping (product); Condition=contains_any(skus, "excluded-SKU1", "excluded-SKU2"); NoShipping
Name=Shipping class 1; MaxWeight<=1; ....

Excluding by Category (e.g. all products that require pickup are in Category with ID 42):
Comment=No shipping for a category; Condition=contains_any(categories, 42); NoShipping
Name=Shipping class 1; MaxWeight<=1; ....

It is important to put that exclusion rule first, because otherwise one of the other rules will match, and the plugin will always use the first matching rule.
Also note that in this case the "Condition=" is required, because the plugin is only able to automatically detect conditions if they contain any comparison operator (<, ==, >, <=, >=, etc.).

I hope this solves all your problems.
Best regards,

Highest price need to be automatically chosen 15 Oct 2014 13:47 #5

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

Thanks for your reply! It works better now.
Unfortunately the price of shipment doesn't change now by ordering more products.
I made these rules, so maybe you can tell me what I do wrong

Name=Gratis boven € 75,00;200<=Amount;Shipping=0
MaxWeight<20; shipping=0.64
MaxWeight=>20<=50; Shipping=1.28
MaxWeight>50<=100; Shipping=1.92
MaxWeight>100<=250; Shipping=2.56
MaxWeight>250<=2000; Shipping=3.84

When i order 3 products of 20 gram weight it doesn't change to the price of € 1.92

Highest price need to be automatically chosen 21 Oct 2014 13:00 #6

First, the syntax for an upper and lower bound is:

Your rules mean the conditions "MaxWeight>=20" and "20<=50" (which is always the case).

Second, in your message above you explained that you wanted the shipping costs of the highest category. Where do "by ordering more products" come in? In your message above you said that if anothe item from a higher shipping "category" is added, that one item from the highest weight determines the shipping and the shipping cost is the fixed cost of 6.95 for the whole order. Now you seem to say that you want to sum up all your weights to determine the shipping.

Somehow I really don't seem to understand your shipping cost structure... How do you explain your shipping costs to your customer?

Best regards,

Highest price need to be automatically chosen 26 Oct 2014 09:50 #7

  • Webdesign
  • Webdesign's Avatar Topic Author
It is solved!
The formules which i used were wrong ...

Thanks and regards,

[SOLVED] Highest price need to be automatically chosen 26 Oct 2014 09:50 #8

  • Webdesign
  • Webdesign's Avatar Topic Author
Problem solved.
  • Page:
  • 1