PluginUs.Net - Business Tools for WooCommerce and WordPress

[realize your idea - make your dreams come true]

Support Forum

You need to log-in to create request (topic) to the support

Free shipping on certain amount disappear after coupon percentage discount

The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday. If you have problems with registration ask help on contact us page please
If you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.

I use WOOCS (currency switcher).
When I apply a percentage discount coupon, free shipping disappears.
It only happens for Russian rubles, but works for EUR, USD and GBP.

Please, help :)

Hello

Paste your license key here - https://share.pluginus.net/image/i20210618130558.png -> https://share.pluginus.net/image/i20210618130614.png

Do you  use  standard  woocommerce   coupons?

Hello, Pablo!

Thank you for your reply.

I've just tested everything. The issue is not connected to a theme, other plugins or only RUB currency. Actually it affects any currencies except the default.
There is a little mistake in the code. The problem is present in free and paid version. You just forgot to backconvert substracted coupon amount from total amount.

In /classes/woocs.php
you backconvert total to the default currency (line 3932), but you don't backconvert the coupon discount (line 3937). So, then, when you substract coupon discount from total, the mistake appears. It's hard to notice that it's present in currencies with similar exchange rates. But you can see it when you get the currency with exchange rate which differs in hundred or ten times. I think you understand.

On line 3937 you have a mistake:

                    $total = $total - WC()->cart->get_discount_total();

Should be something like this instead:

                   $mrm051_discount = (float) $this->back_convert(WC()->cart->get_discount_total(), $currencies[$this->current_currency]['rate']); //mrm051 added this line
                   $total = $total - $mrm051_discount; //mrm051 added this line

 

So then when you check this expression it doesn't evaluate to true because the discount was substracted in rubles from dollars, so the total is wrong. Please, check the code from line 3928 to 3961.

                if ($total >= $min_amount) {
                    $has_met_min_amount = true;
                }

 

I hope you will fix it in the next versions. Have a nice day!

Hello

Please paste your license key here - https://share.pluginus.net/image/i20210618130558.png -> https://share.pluginus.net/image/i20210618130614.png