VirtueMart

WooCommerce

Others

Docs

Support

Blog

About

Shipping By Rules for WooCommerce

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!

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

TOPIC: Help with Shipping Classes

Help with Shipping Classes 04 Jun 2016 19:17 #1

  • kayla_1107
  • kayla_1107's Avatar Topic Author
  • Offline
  • Posts: 4
Hi there,

I purchased the advanced version of the plug in, and I'm trying to set up my flat rate shipping costs per quantities of articles in a shipping class. My code isn't working and I can't figure out why. It works for just the "small-box" shipping class, but when another product is added to the cart, it gets messed up.

Below is what I'm working with:

Condition=contains_only(ShippingClasses, “small-box”); articles<8; Shipping=6.99
Condition=contains_only(ShippingClasses, “small-box”); articles<15; Shipping=13.99
Condition=contains_any(ShippingClasses, "medium-box"); Shipping=13.99
Condition=contains_only(ShippingClasses, "medium-box"); articles<5; Shipping=13.99
Condition=contains_only(ShippingClasses, “small-box”); articles<21; Shipping=18.99
Condition=contains_only(ShippingClasses, "medium-box"); articles<7; Shipping=18.99
Condition=contains_any(ShippingClasses, “large-box”); articles<3; Shipping=18.99


This is essentially what I'm trying to do -
Small Box - 7 Items
Medium Box - 14 Small Items or 4 Medium Items 
Large Box - 2 Large Items or 20 Small Items or 6 Medium Items

I want it to be if any medium or large items are added to the cart, it automatically gets bumped up to that price as well.

Thank you in advance!

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

Help with Shipping Classes 07 Jun 2016 21:02 #2

Dear Kayla,
I would make sure that all rules for small-box are placed first, then for medium sized boxes, we need to allow also small-box products. I.e.:
Condition=contains_only(ShippingClasses, “small-box”); articles<8; Shipping=6.99
Condition=contains_only(ShippingClasses, “small-box”); articles<15; Shipping=13.99
Condition=contains_only(ShippingClasses, “small-box”); articles<21; Shipping=18.99
...
Condition=contains_only(ShippingClasses, "medium-box", "small-box"); articles<5; Shipping=13.99
Condition=contains_only(ShippingClasses, "medium-box", "small-box"); articles<7; Shipping=18.99
...
Condition=contains_any(ShippingClasses, “large-box”); articles<3; Shipping=18.99
...

Best regards,
Reinhold

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

Help with Shipping Classes 09 Jun 2016 02:34 #3

  • kayla_1107
  • kayla_1107's Avatar Topic Author
  • Offline
  • Posts: 4
Hi Reinhold,

Thanks so much for your help. The small box shipping works if I add only small box items to the cart. But for some reason, the cart doesn't recognize it when there's a large item or medium item in the cart, by itself or with any other item. The shipping is still 6.99. I thought the contains_any would automatically bump it up, but I can't seem to get it to work.

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

Help with Shipping Classes 09 Jun 2016 10:35 #4

Dear Kayla,
Are you sure the additional medium or large item has a shipping class ("medium-box" or "large-box") assigned?

If that is not the cause, you can implement some debugging messages:
open-tools.net/documentation/advanced-sh...merce.html#debugging

In particular, you can create an additional shipping method with just one rule:
Name=All variables: <pre>{Values_Debug}</pre>; NoShipping
This will display a long list of all variables, including the ShippingClasses list, so you can check its contents.

Best regards,
Reinhold

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

Help with Shipping Classes 15 Jun 2016 17:33 #5

  • kayla_1107
  • kayla_1107's Avatar Topic Author
  • Offline
  • Posts: 4
Hi there,

Thanks for the suggestion! I ran the debugging, and it's showing that all of the classes are in the cart, but only the small box shipping option is showing up. Do you know why that would be? It works when only small items are in the cart. Below is the debugging message & below that are the rules I'm using.

Thanks so much! I just can't figure out why it's only working for small box items.

Array
(
[year] => 2016
[year2] => 16
[month] => 06
[day] => 15
[weekday] => 3
[hour] => 14
[hour12] => 02
[ampm] => pm
[minute] => 53
[second] => 27
[decisecond] => 8
[centisecond] => 86
[millisecond] => 865
[articles] => 3
[products] => 3
[quantity] => 3
[minquantity] => 1
[maxquantity] => 1
[total] => 91
[subtotal] => 91
[taxtotal] => 7.5075
[taxsubtotal] => 7.5075
[cost] => 98.5075
[amount] => 98.5075
[amountwithtax] => 98.5075
[skus] => Array
(
)

[categories] => Array
(
[0] => dream-catchers
[1] => feathers
[2] => home-decor
[3] => wood
[4] => hang-tags
[7] => crystals
[10] => leather
[11] => spirit-sticks
)

[tags] => Array
(
[0] => air
[1] => dream-catchers
[2] => earth
[3] => native-american
[4] => chakras
[5] => ether
[6] => yoga
)

[shippingclasses] => Array
(
[0] => large-box
[1] => small-box
[2] => medium-box
)

[zip] =>
[postcode] =>
[zip1] =>
[zip2] =>
[zip3] =>
[zip4] =>
[zip5] =>
[zip6] =>
[city] =>
[country] => US
[state] =>
[address1] =>
[address2] =>
[countryid] => US
[weight] => 0
[maxweight] => 0
[minweight] =>
[volume] => 0
[maxvolume] => 0
[minvolume] => 0
[maxlength] => 0
[minlength] =>
[totallength] => 0
[maxwidth] => 0
[minwidth] =>
[totalwidth] => 0
[maxheight] => 0
[minheight] =>
[totalheight] => 0
)


My shipping rules:
Condition=contains_only(ShippingClasses, “small-box”); articles<8; Shipping=6.99
Condition=contains_only(ShippingClasses, “small-box”); articles<15; Shipping=13.99
Condition=contains_only(ShippingClasses, “small-box”); articles<21; Shipping=18.99

Condition=contains_only(ShippingClasses, "medium-box", "small-box"); articles<5; Shipping=13.99
Condition=contains_only(ShippingClasses, "medium-box", "small-box"); articles<7; Shipping=18.99

Condition=contains_any(ShippingClasses, “large-box”); articles<3; Shipping=18.99

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

Help with Shipping Classes 01 Jul 2016 01:35 #6

Dear Kayla,
From the values of the variables, the large box rule should apply and shipping costs of 18.99 should result.

For now, I really cannot think of a situation where the small-box rule would apply with the above variable values. The only reason I can imagine is if one has multiple shipping methods set up (for testing purposes) and the wrong shipping cost is actually generated by one of the other methods.
Apart from that, I really cannot think of a reason. Maybe I could spot the cause of the issue with access to your site's admin area (but I fully understand if you don't want to give a complete stranger temporary access to your webshop's admin area).

Best regards,
Reinhold

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

Help with Shipping Classes 25 Jul 2016 18:36 #7

  • kayla_1107
  • kayla_1107's Avatar Topic Author
  • Offline
  • Posts: 4
I agree, I tried deactivating the other shipping method and was still getting issues. Luckily this isn't something that is too critical at the moment, so I'll keep playing with it and trying to make it work. Thanks for your help!

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

Help with Shipping Classes 25 Sep 2016 22:11 #8

i renamed my classes an got the following:

Evaluation yields unknown value while evaluating rule part 'contains_only(ShippingClasses, “small-box”)'.
Evaluation yields unknown value while evaluating rule part 'contains_only(ShippingClasses,'.
Evaluation yields unknown value while evaluating rule part 'contains_any(ShippingClasses, “large-box”)'.

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

Help with Shipping Classes 30 Sep 2016 21:02 #9

Dear Mediaconsult,
This error message indicates that you use the basic (free) version of the plugin for these rules. The contains_only and contains_any functions are only available in the advanced (paid) version of the plugin. If you have both installed, simply deactivate the basic version and enable the advanced version of the plugin and the rules should work.

Best regards,
Reinhold

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

  • Page:
  • 1

VM - Shopping cart

 x 

Cart empty

Login Formular