Login
Register

VirtueMart

WooCommerce

Others

Docs

Support

Blog

About

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!

×

Notice

The forum is in read only mode.
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Set pricing based on manufacturer count 13 Dec 2017 03:29 #1

  • amelcher
  • amelcher's Avatar Topic Author
I am trying to set up additional shipping rules that are based on the number of manufacturers in the cart.
If there are 3 manufacturers in the cart for instance, there would be an additional $7 fee in addition to whatever the prvious rules I have set up and an additional $7 for every vendor after. So a cart with products from 5 manufacturers for instance would have the calculated shipping costs based on previous rules + another $21 in extra shipping.Any help would be greatly appreciated. Thanks,Adam

Set pricing based on manufacturer count 16 Dec 2017 13:39 #2

Dear amelcher,
Your extra shipping charge for larger numbers of manufacturers is actually quite easy to implement. In the advanced version of the plugin you would add the following at the beginning of your rules (ExtraShippingCharge will apply to all shipping costs determined AFTER that line):
length(Manufacturers)>=3; ExtraShippingCharge=7*(length(Manufacturers)-2)

I'm afraid that in the free version of the plugin there is no way to implement this, as the calculation of "number of manufacturers" requires a function (the "length" function in this example), which is not available in the free version.

Best regards,
Reinhold

[SOLVED] Set pricing based on manufacturer count 16 Dec 2017 20:42 #3

  • amelcher
  • amelcher's Avatar Topic Author
Worked like a charm! I have a small amount of mfgrs that I would like to treat as 1 so if more than one of the manufacturers in this group (let's call them group A) are in the cart, it would only count them as 1 and anything outside of manufacturer group A is bound by the rules you showed me in the previous post, how would I make that happen?

Thanks again for creating such a powerful extension!

Adam

[SOLVED] Set pricing based on manufacturer count 27 Dec 2017 23:39 #4

Dear Adam,
I would use something like the following (untested, but I suppose you get the idea: Remove all members of Group A from the list of manufacturers. This is done using the complement function; If any vendor from Group A is in the list of manufacturers, we'll have to manually add 1, since we removed ALL):
Variable=GroupA; Value=list("manuf1", "manuf2", "manuf3")
Variable=MnfCount; Value=length(complement(Manufacturers, GroupA)) + min(1, length(intersection(Manufacturers, GroupA)))
MnfCount>=3; ExtraShippingCharge=7*(MnfCount-2)
The part with min(1, length(intersection(....))) is not easy to understand if you look at these rules in a few months/years. Basically, if NO manufacturer from GroupA is in the order, then the intersection will be empty, length will be 0 and the min will be 0 => nothing is added. If there is any manufacturer from GroupA in the order, then length will be larger or equal to 1, so the min ensures we count them only as 1.

Best regards,
Reinhold
  • Page:
  • 1