Login
Register

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!

×

Notice

The forum is in read only mode.
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Shipping Spirits limitation 26 Apr 2017 12:30 #1

  • natalia
  • natalia's Avatar Topic Author
FOR WOOCOMMERCE

1. I want to have a rule for Country Russia for no shipping above 2 bottles of spirits (category)
is that correct ?
A.
Name="Shipping not available for Spirits above 2 bottles"; Condition=contains_any(SPIRITS,"spirits"); articles>2; NoShipping
or B.
Name="Category SPIRITS has a maximum order quantity of 2"; 1>=evaluate_for_categories(Articles, 1234)>2; NoShipping
what I have to write for Articles, 1234 ?

2. I want the category of products SPIRITS , NO shipping to Europe

Shipping Spirits limitation 29 Apr 2017 19:32 #2

Dear Natalia,
1. Neither of your rules is correct. The first rule prohibits shipping if ANY bottle of spirit is bought, and the customer buys more than 2 articles (e.g. one bottle and two articles of some other product). Furthermore, the contains_any should be contains_any(categories, "spirits"). The second rule has the correct approach, but has the >= wrong. A correct rule should be:
Name=Shipping not available for more than 2 bottles of spirit; evaluate_for_categories(Articles, "spirits")>2; NoShipping
As the documentation (open-tools.net/documentation/advanced-sh...merce.html#functions) states, the second argument to evaluate_for_categories is the category SLUG (i.e. the unique textual identifier of the category that you entered in WooCommerce when you created the category).

2. To prevent shipping of spirits to the rest of Europe, you would set up a second ruleset or method for the rest of Europe (select all European countries) and use the following rule:
Name="Spirit cannot be shipped to Europe"; "spirits" in Categories; NoShipping
or
Name="Spirit cannot be shipped to Europe"; Condition=contains_any(Categories, "spirits"); NoShipping
Both variants have the same result.

Best regards,
Reinhold

Shipping Spirits limitation 29 Apr 2017 19:50 #3

  • natalia
  • natalia's Avatar Topic Author
I did it like that
1.Name="We are sorry, but alcoholic beverages have a shipping limitation in Russia in 2 bottles. Please reduce your quantities."; Condition=contains_any(ShippingClasses,"alcohol-limitation"); articles>3; Shipping=noshipping

2.Name="Sorry, but we do not deliver Spirits in Europe"; Condition=contains_any(ShippingClasses,"alcohol-limitation"); Shipping=noshipping
Is the shipping classes god as the categories ?
It is working
thank you very much for your help

Shipping Spirits limitation 02 May 2017 18:41 #4

Dear Natalia,
Great to hear that it appears to e working for you. However, I'm not sure that the 1. rule is really what you want. In particular, it will also prevent shipping if a customer buys 1 bottle of spirit and three other articles (because the articles variable will be 4, and the "alcohol-limitation" shipping class will be in the cart, too).

If your condition is actually "at least three bottles of spirits, plus optionally some other articles", then I suppose there is is no way around using one of the evaluate_for_...(Articles, ...) functions. Unfortunately, there is currently no function to evaluate a variable only for all products with a given shipping class (we have added it to our TODO list, but can't say whether or when we will implement this). So, for now you'll need to use evaluate_for_categories:
Name=Shipping not available for more than 2 bottles of spirit; evaluate_for_categories(Articles, "spirits")>2; NoShipping
Please also note that your condition "articles>3" means that four or more articles are bought (> means strictly larger, while >= means larger or equal).

The rule for 2. looks fine.

Regarding your question about categories and shipping classes: There is really not much difference technically. Using shipping classes makes sense if shipping is the only area that is affected, while categories allow you to distinguish for shipping also also in other areas (e.g. the display in your shop). Also, in your particular case, since there is no evaluate_for_shippingclasses function yet, you'll need to use categories to achieve 1.

Best regards,
Reinhold

Shipping Spirits limitation 03 May 2017 16:47 #5

  • natalia
  • natalia's Avatar Topic Author
the rule 1. evaluate_for_categories(Articles, "spirits")>2; NoShipping
has 3 more languages. at English and German is ok, but at Greek and Russian where the slug of the word spirits is
with other characters, we have problem.
GR= evaluate_for_categories(Articles, "οινοπνευματώδη")>2; NoShipping
RU = evaluate_for_categories(Articles, "алкогольные-напитки")>2; NoShipping

can you suggest other solution from changing the slug of these 2 categories to "spirits" ?

Shipping Spirits limitation 03 May 2017 17:57 #6

  • natalia
  • natalia's Avatar Topic Author
even if I created rules for not shipping Spirits to Europe
{Error="Sorry, but we do not deliver Spirits in Europe"; Condition=contains_any(ShippingClasses,"spirits-limitation"); Shipping=noshipping}
or
no more than 2 bottles to Russia
{Name="We are sorry, but alcoholic beverages have a shipping limitation in Russia in 2 bottles. Please reduce your quantities."; evaluate_for_categories(Articles, "spirits")>2; NoShipping}

the message "Sorry, but we do not deliver Spirits in Europe"
or "We are sorry, but alcoholic beverages have a shipping limitation in Russia in 2 bottles..."
is on the cart page
but when I am to the checkout page is asking for the required fields and when I filled them I am able to place the order.
Why?
the checkout was successful with both ways, without creating an account and as a customer with account.
Attachments:

Shipping Spirits limitation 13 May 2017 23:06 #7

Dear Natalia,
Thank you for the screenshots, which provide the missing link to me: It appears that you have multiple other shipping methods set up (Express Worldwide, Express 12:00 and Express 09:00). In your particular order, the shipping by rules method was properly disabled, but as the express Worldwide method was still available, it was used for the order.

It seems that you intended to have your NoShipping apply to all shipping methods, not just the "shipping by rules"-based method. Unfortunately, due to the way WooCommerce implements shipping methods (it simply asks each plugin for a list of shipping rates and then joins all responses to one list that is offered to the user for selection), one shipping method can only disable itself, but it cannot prevent other, unrelated methods from still offering a shipping rate.

If you do not want any shipping method to be offered for spirits, then you need to include those conditions in ALL shipping methods, also in the "Express Worldwide", "Express 12:00" and in the "Express 09:00" shipping methods. It isn't possible technically to disable shipping globally for an order.

Sorry,
Reinhold

PS: Of course, it would be possible to extend WooCommerce with a general plugin to enable/disable methods based on certain conditions, but this is out of scope for our shipping plugin, which is intended to give a shipping rate based on conditions.

Shipping Spirits limitation 17 May 2017 10:02 #8

  • natalia
  • natalia's Avatar Topic Author
the rule 1. evaluate_for_categories(Articles, "spirits")>2; NoShipping
has 3 more languages. at English and German is ok, but at Greek and Russian where the slug of the word spirits is
with other characters, we have problem.
GR= evaluate_for_categories(Articles, "οινοπνευματώδη")>2; NoShipping
RU = evaluate_for_categories(Articles, "алкогольные-напитки")>2; NoShipping

can you suggest other solution from changing the slug of these 2 categories to "spirits" ?

Shipping Spirits limitation 26 May 2017 01:48 #9

Dear Natalia,
Thank you for noticing this issue. Non-latin characters in SLUGs indeed causes problems, as WordPress stores all SLUGs as URL-encoded, while our plugin does a verbatim comparison. To make things work, we'll have to URL-decode all SLUGs first...

We'll include the fix in our upcoming version 2.0 of the plugin (which also marks the switch to WooCommerce's shipping zones). The release should happen in the next few days/week. The release candidate is almost ready...

Best regards,
Reinhold
  • Page:
  • 1