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!



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


Code postal 10 Jan 2017 20:29 #1

  • femball
  • femball's Avatar Topic Author
j'utilise Woocommerce pour permettre à mes visiteurs d'acheter des plats à emporter que je livre moi même.seul soucis dans ma région les villes ont toutes le même code postal et je ne les livre pas toutes. comment faire pour que mes commandes soient acepteés pour mon secteur de livraison et refuser pour les autres villes? J'ai la version payante de WooCommerce Advanced Shipping By Rules

Code postal 14 Jan 2017 23:13 #2

Dear FemBall,
Sorry, I don't speak French, so here is my answer in English (and run through translate.google.com, which might or might not make sense in French. Sorry!).

If you have multiple cities with the same postal code, but different name, which you need to distinguish for shipping, then I think the only way is to check the city name. Notice, however, that your customers might use different spellings / misspellings of the city names, so there is always a chance that you miss a city or wrongly classify a city as no-delivery (or as a delivery city). An example:
Warning="Sorry, we do not ship to City1"; ZIP==12345; City=="City1"; NoShipping
Warning="Sorry, we do not ship to City1"; ZIP==12345; City=="city1"; NoShipping
Warning="Sorry, we do not ship to City1"; ZIP==12345; City=="Citi1"; NoShipping
Warning="Sorry, we do not ship to City1"; ZIP==12345; City=="Citty1"; NoShipping
Name="Shipping to City2"; ZIP==12345; City=="City2";  Shipping=3
Name="Shipping to City3"; ZIP==12345; City=="City3";  Shipping=13
Name="Sorry, we don't ship to City4"; ZIP==12345; City=="City4"; NoShipping
As you can see with the City1 example, you would have to check all different kinds of spellings (in French probably also all different kinds of accented vowels, i.e. the city names with é and with e, etc.). That gets messy quite easily.

Don't you have any other way to decide whether you ship to a given destination?

Best regards,

Code postal 14 Jan 2017 23:15 #3

oici la traduction automatique de Google. Désolé si certaines phrases sont incompréhensibles:

Cher FemBall,
Désolé, je ne parle pas le français, alors voici ma réponse en anglais (et passez à travers translate.google.com, qui pourrait ou ne pas avoir de sens en français. Désolé!).

Si vous avez plusieurs villes avec le même code postal, mais un nom différent, que vous devez distinguer pour l'expédition, alors je pense que la seule façon est de vérifier le nom de la ville. Notez cependant que vos clients peuvent utiliser différentes orthographes / fautes d'orthographe des noms de ville, il ya donc toujours une chance que vous manquez une ville ou classer à tort une ville comme la non-livraison (ou comme une ville de livraison). Un exemple:
Warning = "Désolé, nous n'embarquons pas City1"; ZIP == 12345; City == "City1"; NoShipping
Warning = "Désolé, nous n'embarquons pas City1"; ZIP == 12345; City == "city1"; NoShipping
Warning = "Désolé, nous n'embarquons pas City1"; ZIP == 12345; City == "Citi1"; NoShipping
Warning = "Désolé, nous n'embarquons pas City1"; ZIP == 12345; City == "Citty1"; NoShipping
Name = "Expédition vers City2"; ZIP == 12345; City == "City2"; Shipping = 3
Name = "Livraison vers City3"; ZIP == 12345; City == "City3"; Shipping = 13
Name = "Désolé, nous ne livrons pas à City4"; ZIP == 12345; City == "City4"; NoShipping
Comme vous pouvez le voir avec l'exemple de City1, vous devrez vérifier tous les différents types d'orthographe (en français probablement aussi tous les différents types de voyelles accentuées, c'est-à-dire les noms de villes avec é et avec e, etc.). Cela devient désordonné assez facilement.

N'avez-vous pas d'autre moyen de décider si vous expédiez à une destination donnée?

Meilleures salutations,

Code postal 20 Jan 2017 23:09 #4

  • femball
  • femball's Avatar Topic Author
Thank you for the quick reply.
Unfortunately I have no other selection possibilities.
Think that including a "select" in the choice of cities with this would be easier.
The problem is that I do not see where.

I have another question:
Here is the code for my shipments:

Amount <= 20; Shipping = 2.50
Amount> 20; Shipping = Amount * 0.1

I have to partner with an association and I want to create a code that allows members to enter a unique promo code that allows a discount of 0.50cts but only on delivery. Is it possible ?

Here is the current code that I entered but it does not work:


Name = Friendly; Amount <= 20; Condition = contains_any (Coupons, "Amicale31800"); Shipping = 2
Amount <= 20; Shipping = 2.50
Name = Friendly; Amount> 20; Condition = contains_any (Coupons, "Amicale31800"); Shipping = Amount * 0.1-0.5
Amount> 20; Shipping = Amount * 0.1
Remove this ruleset

Code postal 24 Jan 2017 23:10 #5

Dear Femball,
First, there is no built-in way to replace the city input box by a select box in WooCommerce. One might be able to write a plugin to achieve this (WooCommerce is very flexible in that regard and provides hooks and filters for almost all actions), but I have not checked whether this would really work.

Regarding your other question about the coupon:
Your rules look good to me, except that in WooCommerce all coupons are automatically converted to lower-case. So I would expect that you need to check for the coupon code "amicale31800" rather than "Amicale31800".

If that does not work, I would first check whether the coupons variable really has the proper value. You can do this by prepending the following rule, which will print out a debug message with a long list of all available variables (the coupons are near the end):
Message=All variables: <pre>{Values_Debug}</pre>; Value=0

Best regards,

Code postal 24 Jan 2017 23:18 #6

PS: if you want to give 50 cent shipping cost discount when the coupon is given, you do not need to include this in every rule. Rather, you can use the ExtraShippingCharge, which defines an addon (or in this case discount) that will be applied to whatever shipping costs the following rules will calculate:
Name="50ct shipping discount with coupon"; "amicale3180" in Coupons; ExtraShippingCharge=-0.5
Amount <= 20; Shipping = 2.50
Amount> 20; Shipping = Amount * 0.1

However, in this case you cannot add the (Friendly) string to the shipping method's name displayed to the customer.
  • Page:
  • 1