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:

[SOLVED] Shipping rule by weight (half a kg) 06 Mar 2014 10:44 #1

  • dchristof
  • dchristof's Avatar Topic Author
Dear Reinhold, I would really appreciate your help on my issue (I started a topic yesterday but I think it got lost..) because I'm busting my head for days and can't seem to construct my rules quite right:

I want to charge for a specific zone:
- weight<=0,5kg -> 22 euros
- 0,5<weight<=5kg -> 2 euros for each additional 0,5kg (so for 1,5kg it will be 26 euro)
- 5<weight<=30kg -> 1,5 euro for each additional 0,5kg (so for 6,5kg it will be 44,5 euro)
- weight>30kg -> 2 euro for each additional 0,5kg (so for 31,5kg it will be 124 euro)

So I wrote the following 2 rules for 0,5kg and up to 5kg which seem to work:

Name=Balkans & Meditteranean up to 0.5Kg - Order weight: {weight}Kg; 0<Weight<=0.5; Shipping=22
Name=Balkans & Meditteranean up to 5Kg - Order weight: {weight}Kg; 0.5<Weight<=5; Shipping=22 + (floor((Weight-0.5)*2)/2) *4

But I've been trying to construct a rule for my 3rd case (5<weight<=30kg) with no success. I tried this:
Name=Balkans & Meditteranean up to 30Kg - Order weight: {weight}Kg; 5<Weight<=30; Shipping=21.5 + (floor((Weight-0.5)*2)/2) *4
and this:
Name=Balkans & Meditteranean up to 30Kg - Order weight: {weight}Kg; 5<Weight<=30; Shipping=40 + (floor((Weight)*2)/2)/2
but I don't always get correct results..
[ Note: I'm using floor(weight*2)/2 to round to nearest half decimal ]

I haven't tried to construct the weight>30kg rule since I can't seem to make the above one work.

Any ideas on my problem? I have fried my brain by now and can't seem to make any progress..

[SOLVED] Shipping rule by weight (half a kg) 06 Mar 2014 16:38 #2

  • dchristof
  • dchristof's Avatar Topic Author
Dear Reihold, never mind, I managed to fix my rules so I'm posting here in case it helps anyone else:

since my problem was different shipping costs per 0.5kg that's what i did

For a specific zone I had the following requirements:
- weight<=0,5kg -> 22 euros
- 0,5<weight<=5kg -> 2 euros for each additional 0,5kg (so for 1,5kg it will be 26 euro)
- 5<weight<=30kg -> 1,5 euro for each additional 0,5kg (so for 6,5kg it will be 44,5 euro)
- weight>30kg -> 2 euro for each additional 0,5kg (so for 31,5kg it will be 124 euro)

and the shipping rules are:
Name=Zone1 up to 0.5Kg - Order weight: {weight}Kg; 0<Weight<=0.5; Shipping=22
Name=Zone1 up to 5Kg - Order weight: {weight}Kg; 0.5<Weight<=5; Shipping=22 + (floor((Weight-0.5)/0.5))*2
Name=Zone1 up to 30Kg - Order weight: {weight}Kg; 5<Weight<=30; Shipping=40 + (floor((Weight-5)/0.5))*1.5
Name=Zone1 more than 30Kg - Order weight: {weight}Kg; Weight>30; Shipping=115 + (floor((Weight-30)/0.5))*2

and it works just fine.

[SOLVED] Shipping rule by weight (half a kg) 08 Mar 2014 17:31 #3

Congrats to those rules. I would basically have done it similar.
  • Page:
  • 1