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:

Shipping Category 18 Nov 2016 13:14 #1

  • FrancescoDionisi
  • FrancescoDionisi's Avatar Topic Author
Good Morning, in my ecommerce i have 2 macro categories with some sub categories, and i wold to make this solution:

CATEGORY WINE =35 Shipping cost: 10
subcategory 1 =40 Shipping cost: 10
subcategory 2 =39 Shipping cost: 10
subcategory 3 =43 Shipping cost: 10
subcategory 4 =45 Shipping cost: 10
subcategory 5 =44 Shipping cost: 10
subcategory 6 =41 Shipping cost: 10
CATEGORY OIL=36
subcategory 1 =48 Shipping cost: 15
subcategory 2 =37 Shipping cost: 15
subcategory 3 =46 Shipping cost: 15

In the checkout, if the customer have selected a product from oil and qwinke category, to sum the shippingo cost; for example
Category OIL
product 1 Shipping cost: 15
category WINE
product 2 Shipping cost: 10
Total Cost: 25

Can You help Me?
Thanksss

Shipping Category 30 Nov 2016 22:24 #2

Dear FrancescoDionisi,
If I understand you correctly, all subcategories of a category have the same per-article shipping cost. In the advanced (i.e. paid) version of our plugin we have the functions evaluate_for_categories(VARIABLE, category_id) and evaluate_for_subcategories(VARIABLE, parentcategory_id), which evaluate the VARIABLE for all products in the cart that belong to the given category (or in the second function belong to the given category or any of its subcategories).

So the rule for your shipping cost structure would then simply be:
Shipping=10*evaluate_for_subcategories(Articles, 35) + 15*evaluate_for_subcategories(Articles, 36)

Best regards,
Reinhold

Shipping Category 16 Dec 2016 12:40 #3

  • FrancescoDionisi
  • FrancescoDionisi's Avatar Topic Author
Thaks A lot; it's perfct.
Now i'm lockd at anothe rules:

1-st rule ---- 29<=Articles<=30; 4 in Manufacturers; state2 in list("RM", "NA"); Shipping=23.18
2-nd rule----<=Weight<=100; 59 in Categories; state2 in list("RM", "NA"); Shipping=24.40
3-rd rule----If both rules are met, the expenses are the sum of the previous two

Can you help me please?

Shipping Category 18 Dec 2016 11:56 #4

Dear Francesco,
The plugin stops at the first rule that matches and gives a shipping cost (i.e. has a Shipping=... or NoShipping part). If you want to sum up multiple rules/results, there are two approaches:
1. Use ExtraShippingCharge=..., which is gives an additional charge that is added to the shipping cost of the rule that matches. One has to pay attention that for this to work, a matching rule must exists. E.g.
1-st rule ----as above
2-nd rule----as above
3-rd rule----Shipping is always the sum of these (0 if none of them matches, all extra shipping charges are automatically added):
29<=Articles<=30; 4 in Manufacturers; state2 in list("RM", "NA"); ExtraShippingCharge=23.18
0<=Weight<=100; 59 in Categories; state2 in list("RM", "NA"); ExtraShippingCharge=24.40
Shipping=0

2. You can use custom variables to collect all shipping charges:
Variable=MyCost; Value=0
Variable=MyCost; 29<=Articles<=30; 4 in Manufacturers; state2 in list("RM", "NA"); Value=MyCost + 23.18
Variable=MyCost; 0<=Weight<=100; 59 in Categories; state2 in list("RM", "NA"); Value=MyCost + 24.40
Shipping=MyCost

Best regards,
Reinhold

Shipping Category 19 Dec 2016 09:25 #5

  • FrancescoDionisi
  • FrancescoDionisi's Avatar Topic Author
Good Morning,
i implement the rules, but not working; the shipping cost is ever the secon. 24.40€

can you help me?

Thank You so much

Shipping Category 21 Dec 2016 11:17 #6

Dear Francesco,
The first rule contains the condition 29<=Articles<=30, so it only applied to orders that have exactly 29 or 30 articles (greater or equal to 29, but smaller or equal to 30). Are you sure you are testing with such an order?
To be honest, I don't think you really want this condition. Can you describe your exact shipping cost structure in words? It is then often much easier to formulate/correct the rules accordingly.

Best regards,
Reinhold

Shipping Category 21 Dec 2016 17:28 #7

  • FrancescoDionisi
  • FrancescoDionisi's Avatar Topic Author
Dear Reinhold,
thanks for your invaluable help, I edited your rule in this way and I solved:

1<=evaluate_for_categories(Articles, 36,46.47,48,35,39,43,45,44,41,40)<=30; 4 in Manufacturers; state2 in list("RM", "NA"); ExtraShippingCharge=23.18..

Now if it's possible i have another request..Now on the site i have this shipping methods:

1<=evaluate_for_categories(Articles, 36,46.47,48,35,39,43,45,44,41,40)<=30; 4 in Manufacturers; state2 in list("RM", "NA"); ExtraShippingCharge=23.18
1<evaluate_for_categories(Weight, 59)<=100; 59 in Categories; state2 in list("RM", "NA"); ExtraShippingCharge=24.40
1<evaluate_for_categories(Weight, 60)<=100; 60 in Categories; state2 in list("RM", "NA"); ExtraShippingCharge=18.30
1<evaluate_for_categories(Weight, 61)<=100; 61 in Categories; state2 in list("RM", "NA"); ExtraShippingCharge=12.20
Shipping=0
but I wish when there are categories, 59 or 60, or 61, the shipping price is the highest among the 3, or between the two there will be summed.

first example:
Product of category 46
ExtraShippingCharge = 23:18

Product of category 60
ExtraShippingCharge = 18:30

Product of category 61
ExtraShippingCharge = 12:20

Total Shipping 23:18 18:30 +

second example:

Product of category 46
ExtraShippingCharge = 23:18

Product of category 60
ExtraShippingCharge = 18:30

Product of category 61
ExtraShippingCharge = 12:20

Product of category 59
ExtraShippingCharge = 24.40

Total Shipping 23:18 + 24.40

Ever the cost must hight between categories 59 - 60 - 61

Thankyou so much

Shipping Category 22 Dec 2016 22:21 #8

Dear FancescoDionisi,
First, your evaluate_for_categories call has a typo where you use decimal point instead of a comma between 46 and 37.

Regarding your shipping costs where you want to use the highest of categories 59, 60 and 61, I suppose the easiest way is to use custom variables:
1<=evaluate_for_categories(Articles, 36,46.47,48,35,39,43,45,44,41,40)<=30; 4 in Manufacturers; state2 in list("RM", "NA"); ExtraShippingCharge=23.18

Variable=Cat596061;Value=0
Variable=Cat596061;1<evaluate_for_categories(Weight, 59)<=100; 59 in Categories; state2 in list("RM", "NA"); Value=max(Cat596061, 4.40)
1<evaluate_for_categories(Weight, 60)<=100; 60 in Categories; state2 in list("RM", "NA"); Value=max(Cat596061, 18.30)
1<evaluate_for_categories(Weight, 61)<=100; 61 in Categories; state2 in list("RM", "NA"); Value=max(Cat596061, 12.20)
ExtraShippingCharge = Cat596061

Shipping=0

Best regards,
Reinhold
  • Page:
  • 1