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:

Calculation of shipping cost 19 Oct 2015 20:18 #1

  • mangoni
  • mangoni's Avatar Topic Author
Hi everybody,
have a problem with the calculation of shipping costs. I have four kind of products in my shop, each of them with his own shipment cost.
I would like to know if there's a way to obtain the overall shipment cost by discriminate every kind of product contained in the cart (I was thinking about using SKU to discriminate the specific product in the cart).

I write an example to clarify doubts.
We have 4 kind of product: A (shipment cost: 20€) - B (sc: 25€) - C (sc: 30€) - D (sc: 15€)
The customer buys two articles of product A and one article of product C, so the overall shipment cost should be: (20x2) + (30x1) = 70€
Is there such a way to write a rule to obtain this result?

Thanks in advance.

Calculation of shipping cost 20 Oct 2015 01:21 #2

Dear Mangoni,
Do I understand you correctly that you have only four products (each with a different SKU) in your shop? In that case, there is a way to achieve what you want with the advanced version of the plugin:
Shipping=evaluate_for_skus(Articles, "A")*20 + evaluate_for_skus(Articles, "B")*25 + evaluate_for_skus(Articles, "C")*30 + evaluate_for_skus(Articles, "D")*15
In this example, I used "A", "B", "C" and "D" as the SKUs. If you have multiple products, but want to distinguish those four types by the category assigned to the products, simply use evaluate_for_categories with the appropriate category ID instead of evaluate_for_skus.

Best regards,
Reinhold

Calculation of shipping cost 20 Oct 2015 12:44 #3

  • mangoni
  • mangoni's Avatar Topic Author
Hi Reinhold,
thanks for your reply. Is this rule right even if in the cart there are more articles of the same product?
For example, if the customer has in the cart 2 articles of product A and 2 articles of product B, I should modify the rule like this:

Shipping=evaluate_for_skus(Articles, "A")*(20*Articles) + evaluate_for_skus(Articles, "B")*(25*Articles) + evaluate_for_skus(Articles, "C")*(30*Articles) + evaluate_for_skus(Articles, "D")*(15*Articles)

In this way I should obtain something like this:

Shipping = 1*(20*2) + 1*(25*2)+0*(30*0)+0*(15*0) = 90

which is the total shipment cost I want to obtain. Am i right or not?

Thank you

Calculation of shipping cost 20 Oct 2015 15:13 #4

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

tried to apply the rule you write to me either with evaluate_for_skus or evaluate_for_categories but there is always this error:

Evaluation yields unknown value while evaluating rule part 'evaluate_for_skus(Articles, TM100)*110 + evaluate_for_skus(Articles, TXL100)*110 + evaluate_for_skus(Articles, TXS100)*85 + evaluate_for_skus(Articles, SH100)*110 + evaluate_for_skus(Articles, SE100)*110'.

Evaluation yields unknown value while evaluating rule part 'evaluate_for_categories(Articles, 7)*110 + evaluate_for_categories(Articles, 8)*110 + evaluate_for_categories(Articles, 6)*85 + evaluate_for_categories(Articles, 10)*110 + evaluate_for_categories(Articles, 9)*110'.

Can you help me? Thank you

UPDATE: I solved the problem. The rule you write for me is perfect.
Thank you again!

[SOLVED] Calculation of shipping cost 20 Oct 2015 19:13 #5

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