VirtueMart

WooCommerce

Others

Docs

Support

Demo

Blog

About

Forum
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: [SOLVED] Set pricing based on manufacturer count

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

  • amelcher
  • amelcher's Avatar Topic Author
  • Offline
  • Posts: 2
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

Please Log in or Create an account to join the conversation.

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

Please Log in or Create an account to join the conversation.

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

  • amelcher
  • amelcher's Avatar Topic Author
  • Offline
  • Posts: 2
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

Please Log in or Create an account to join the conversation.

[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

Please Log in or Create an account to join the conversation.

  • Page:
  • 1

VM - Shopping cart

 x 

Cart empty

Login Formular