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 pleaseIf 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.
Quote from Rok on November 21, 2022, 20:42Using 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
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
Quote from Rok on November 21, 2022, 21:02/?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 ()
/?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 ()
Quote from Pablo Borysenco on November 22, 2022, 12:28Hello
but your code is not correct
Where is this line - https://share.pluginus.net/image/i20221122102814.png
Hello
but your code is not correct
Where is this line - https://share.pluginus.net/image/i20221122102814.png
Quote from Rok on November 22, 2022, 12:46I 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
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
Quote from Rok on November 22, 2022, 12:47Ok here is this code snippet only:
https://currency-switcher.com/woocommerce-smart-cod
Ok here is this code snippet only:
Quote from Rok on November 22, 2022, 12:50What is wrong with the line here: https://share.pluginus.net/image/i20221122102814.png
Should this be changed? How? Please.
What is wrong with the line here: https://share.pluginus.net/image/i20221122102814.png
Should this be changed? How? Please.
Quote from Rok on November 22, 2022, 12:52Oh I see 3 rrr-s
$rate = $currencies[$currrent]['rate'];should be
$rate = $currencies[$current]['rate'];
I will try, thanks.
Oh I see 3 rrr-s
 $rate = $currencies[$currrent]['rate'];
should be
$rate = $currencies[$current]['rate'];
I will try, thanks.
Quote from Rok on November 22, 2022, 12:55Oh 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.
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.
Quote from Rok on November 22, 2022, 13:03I 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=feeTHE 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.
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.
Quote from Pablo Borysenco on November 23, 2022, 11:19Hello
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
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
