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

WooCommerce Smart COD - AJAX ERROR

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.

Using WOOCS - WooCommerce Currency Switcher in combination with WooCommerce Smart COD

Followed instructions here: https://currency-switcher.com/search?s=fee

Inserted this code you advice:

add_filter('wc_smart_cod_fee', function($fee, $settings) {
if (class_exists('WOOCS') AND $fee) {
global $WOOCS;
if ($WOOCS->is_multiple_allowed) {
$currrent = $WOOCS->current_currency;
if ($currrent != $WOOCS->default_currency) {
$currencies = $WOOCS->get_currencies();
$rate = $currencies; $fee = $fee * $rate;
}
}
}
return $fee; }, 2, 100);

.... it throws ajax error in Chrome developer tools and blocks checkout:
wc-ajax=update_order_review 500
wc-ajax=get_refreshed_fragments 500

/?wc-ajax=update_order_review:1 Failed to load resource: the server responded with a status of 500 ()
/?wc-ajax=get_refreshed_fragments:1 Failed to load resource: the server responded with a status of 500 ()

Hello

but your code is not correct

Where is this line - https://share.pluginus.net/image/i20221122102814.png

I copy pasted the code.
Maybe here in editor when I pasted got screwed.

This is the code screenshot is it right?
https://ibb.co/PzwGbdt

Ok here is this code snippet only:

https://currency-switcher.com/woocommerce-smart-cod

What is wrong with the line here: https://share.pluginus.net/image/i20221122102814.png

Should this be changed? How? Please.

Oh I see 3 rrr-s
$rate = $currencies[$currrent]['rate'];

should be

$rate = $currencies[$current]['rate'];

I will try, thanks.

Oh no,.. the codes for the WooCommerce Smart COD plugin are different...

here https://currency-switcher.com/search?s=fee

and

here https://currency-switcher.com/woocommerce-smart-cod

... different at the end.

I can confirm this code works: https://currency-switcher.com/woocommerce-smart-cod
The code here doesn't, should be corrected with the working one: https://currency-switcher.com/search?s=fee

THE WORKING CODE:
add_filter('wc_smart_cod_fee', function($fee, $settings) {
if (class_exists('WOOCS') AND $fee) {
global $WOOCS;
if ($WOOCS->is_multiple_allowed) {
$currrent = $WOOCS->current_currency;
if ($currrent != $WOOCS->default_currency) {
$currencies = $WOOCS->get_currencies();
$rate = $currencies[$currrent]['rate'];
$fee = $fee * $rate;
}
}
}
return $fee;
}, 2, 100);

Thanks @pavlo_borysenco for the help putting to the right path! :-)

The codes in documentation really are different one hardly spots it.
Should be corrected.

Hello

Great! Welcome;)

The codes in documentation really are different one hardly spots it. - Looks like it's a formatting issue on the search page. thanks for the info