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

Invalid coupon amount

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.

Hi,

I've noticed some strange behaviour in your plugin.

When the option"Individual fixed amount for coupon" for plugin WooCommerce Currency Switcher is on and the client added a coupon (percentage, 10) no special rules, unlimited usage.

Then the coupon works properly in cart for the base currency. As soon as the currency was switched from default to for example EUR then the coupon started to throw a fatal error in the cart.

Some stack trace:

PHP Fatal error: Uncaught WC_Data_Exception: Invalid discount amount in /var/www/html/web/wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-data.php:856
Stack trace:
#0 /var/www/html/web/wp-content/plugins/woocommerce/includes/class-wc-coupon.php(528): WC_Data->error('coupon_invalid_...', 'Invalid discoun...')
#1 /var/www/html/web/wp-content/plugins/woocommerce-currency-switcher/classes/woocs_after_33.php(4634): WC_Coupon->set_amount('150')
#2 /var/www/html/web/wp-includes/class-wp-hook.php(303): WOOCS->woocommerce_coupon_loaded(Object(WC_Coupon))
#3 /var/www/html/web/wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters('', Array)
#4 /var/www/html/web/wp-includes/plugin.php(470): WP_Hook->do_action(Array)
#5 /var/www/html/web/wp-content/plugins/woocommerce/includes/data-stores/class-wc-coupon-data-store-cpt.php(150): do_action('woocommerce_cou...', Object(WC_Coupon))
#6 /var/www/html/web/wp-content/plugins/woocommerce/includes/class-wc-data-store.php(159): WC_Coupon_Data_Store_CPT->read(Object(WC_Coupon))
#7 in /var/www/html/web/wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-data.php on line 856
This leads to the culprit which is woocs_after_33.php #4600 woocommerce_coupon_loaded()
line 4619 if ($this->is_fixed_coupon) {} which is read from the options as far as I saw.
In the end when debugging it caused a confusion to woocommerce because the amount was translated from 10% to 150 -> and this throws an error as the percentage can't be more than 100.
I am not sure what this function is doing  because it doesn't allow me to enter multiple currencies in the coupon edition menu in Woocommerce.
But fixing the fatal error is as easy as disabling it. Is this a bug? Or do I not understand the functionality?

Hello

Paste your license key here - https://share.pluginus.net/image/i20210618130558.png -> https://share.pluginus.net/image/i20210618130614.png and FTP+  wp-admin access - https://share.pluginus.net/image/i20210618130637.png

Update  the  plugin  to latest  version - https://currency-switcher.com/how-to-make-auto-update-for-wordpress-plugins-and-themes-bought-on-envato

Hi,

Thanks for the reply. I realised that the clients plugin is not up to date. And this plugin was bought in 2019 according to the changelog.

If we update to the latest version this isn't happening?

Test case:

  1. Set Individual fixed amount for coupon to ON
  2. set coupon to percentage, value 10 in woocommerce
  3. Select product currency other than default
  4. Add to cart
  5. Apply percentage coupon in checkout

Hello

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

We do not support older versions of the plugin

Thanks for the reply. You can remove this topic in that case.

Hello

Ok!  Great!