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: [SOLVED] Reduced Shipping with Coupon Code

Reduced Shipping with Coupon Code 16 Jun 2016 19:27 #1

  • hawortDe
  • hawortDe's Avatar Topic Author
  • Offline
  • Posts: 1
Hello,

We have purchased the Advanced Shipping By Rules and have run into some troubles applying a coupon code.

The goal is to offer standard 9.99 shipping unless a customers applies a specific coupon code which would reduce the price of the product AND the shipping to 5.95.

The problem is that when a customer adds the product to the cart the 5.95 shipping display BEFORE the coupon is added.

Please see attached the configurations and cart screenshot.
Thoughts?
Attachments:

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

Reduced Shipping with Coupon Code 23 Jun 2016 22:52 #2

Dear hawortDe,
Please try prepending "Condition=" to contains_only, i.e.
Name=5.95 Shipping; Condition=contains_only(Coupon, "ss1offer"); Shipping=5.95

The reason is that under some circumstances the plugin does not correctly identify the "contains_only" function as a condition. The "Condition=" explicitly forces the plugin to treat that part as a condition.

Best regards,
Reinhold

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

Reduced Shipping with Coupon Code 25 Jun 2016 14:56 #3

Hello Reinhold,

I hate to be using this support forum this much, but while trying to implement a similar rule as hawortDe, I tried a couple different approaches, but none worked.

The hawortDe approach:
Condition=contains_only(Coupon, "Roberta"); Shipping=5.95

At least didn't offer reduced shipping, but didn't change the shipping costs when a coupon with the code "Roberta" was added. And I got following errormessage:
List function 'contains_only' requires the first argument to be lists. (Full rule: 'Condition=contains_only(Coupon, "Roberta"); Shipping=5.95')

Leaving Condition= away, resulted in the same problem hawortDe was mentioning.

A further approach I tried, because I thought Coupon isn't a list was:
Coupons=="Roberta"; Shipping=5.95
condition=Coupons=="Roberta"; Shipping=5.95
Coupon=="Roberta"; Shipping=5.95
condition=Coupon=="Roberta"; Shipping=5.95

But this way it also didn't react to the fitting coupon code and didn't give an errormessage.
It's not very urgent at the moment, but it would be nice to have a solution.

Thanks
Lukas

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

Reduced Shipping with Coupon Code 29 Jun 2016 12:34 #4

Dear Lukas,
Sorry, I just realized I made a small typo: the variable containing the coupon codes is Coupons (plural!), so this should be the correct rule:
Condition=contains_only(Coupons, "Roberta"); Shipping=5.95

Best regards,
Reinhold

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

Reduced Shipping with Coupon Code 29 Jun 2016 12:56 #5

Hello Reinhold,

I hate to say it, but it still doesn't work:
List function 'contains_any' requires the first argument to be lists. (Full rule: 'Condition=contains_any(Coupons, "Roberta"); Shipping=5.95')

Lukas

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

Reduced Shipping with Coupon Code 30 Jun 2016 00:38 #6

Dear Lukas,
Thanks for your quick reply. There was indeed a bug in the latest version of the plugin, which didn't make the Coupons variable public for use in the rules. We have just released version 1.2.2 of the plugin, which should fix your issues for good.

Please let us know if you still have issues.

Best regards,
Reinhold

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

Reduced Shipping with Coupon Code 30 Jun 2016 22:35 #7

Perfect, no it works!
Thank you!

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

[SOLVED] Reduced Shipping with Coupon Code 30 Jun 2016 23:40 #8

Problem solved.

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

[SOLVED] Reduced Shipping with Coupon Code 01 Jul 2016 13:56 #9

Maybe just a quick thing to add.

the function contains_only doesn't work for this kind of condition, because it also is true, when the list of coupons is empty.
The function that worked for me, was contains_any, which only reacts when the coupon with the right code is inserted.

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

[SOLVED] Reduced Shipping with Coupon Code 01 Jul 2016 22:07 #10

Nice catch! You are right, to check whether a certain coupon was entered, you should not use contains_only, because that will break if no coupon was used and it will also break if more than one coupons were entered. As you correctly realize, you should use
Condition=contains_any(Coupons, "my-coupon-code")

On the other hand, if you want to check whether one particular coupon was entered, but no other coupon (i.e. only the coupon "my-coupon-code", but no other coupons), then you should compare the Coupons variable with the one-element list:
Coupons==list("my-coupon-code")
This condition will only hold true if "my-coupon-code" was entered, but no other coupon.

Best regards,
Reinhold

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

  • Page:
  • 1

VM - Shopping cart

 x 

Cart empty

Login Formular