Prices not showing correct on 'WooCommerce product addons' plugin
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 nathanot19 on October 10, 2024, 21:34Good evening,
I tried the code from the following topic to make FOX currency switcher work with the WooCommerce product addons plugin.
https://pluginus.net/support/topic/woocommerce-product-addon-with-fox-currency/
However, I am experiencing some problems after implementing this code:
1. The addon prices are converted to the correct currency, but they are not rounded like all product prices. (For rounding, I use your ‘woocs_raw_woocommerce_price’ hook)
2. When I add a product addon to the cart, the price that appears in the cart no longer matches the addon's original price.
I hope I can get some help with this. If necessary, I can share my login details.
Kind regards,
Nathan
Good evening,
I tried the code from the following topic to make FOX currency switcher work with the WooCommerce product addons plugin.
https://pluginus.net/support/topic/woocommerce-product-addon-with-fox-currency/
However, I am experiencing some problems after implementing this code:
1. The addon prices are converted to the correct currency, but they are not rounded like all product prices. (For rounding, I use your ‘woocs_raw_woocommerce_price’ hook)
2. When I add a product addon to the cart, the price that appears in the cart no longer matches the addon's original price.
I hope I can get some help with this. If necessary, I can share my login details.
Kind regards,
Nathan
Quote from Pablo Borysenco on October 11, 2024, 09:18Hello Nathan
1 In this case you need code customization( Add rounding code )
2 Please check the code on your site carefully and compare it with the code from the article - https://currency-switcher.com/woocommerce-product-add-ons
Hello Nathan
1 In this case you need code customization( Add rounding code )
2 Please check the code on your site carefully and compare it with the code from the article - https://currency-switcher.com/woocommerce-product-add-ons
Quote from nathanot19 on October 11, 2024, 11:55Hi,
Thanks for the response!
I had already followed this article, however, it does not seem to be completely up to date anymore. The WooCommerce plugin has since been updated several times so the code no longer matches the one in the article.
After some research, I came across an earlier topic of yours, which was a bit more up to date with the plugin. However, I also run into the same problem with this code:
https://pluginus.net/support/topic/woocommerce-product-addon-with-fox-currency/
I tried implementing both codes, but unfortunately the problems persist.
As for rounding, I already use the necessary rounding code for this. However, this has no effect on the addon prices.
Kind regards,
Nathan
Hi,
Thanks for the response!
I had already followed this article, however, it does not seem to be completely up to date anymore. The WooCommerce plugin has since been updated several times so the code no longer matches the one in the article.
After some research, I came across an earlier topic of yours, which was a bit more up to date with the plugin. However, I also run into the same problem with this code:
https://pluginus.net/support/topic/woocommerce-product-addon-with-fox-currency/
I tried implementing both codes, but unfortunately the problems persist.
As for rounding, I already use the necessary rounding code for this. However, this has no effect on the addon prices.
Kind regards,
Nathan
Quote from Pablo Borysenco on October 11, 2024, 12:22Please try this:
New code:
In file wp-content\plugins\woocommerce-product-addons\includes\class-wc-product-addons-cart.php add next code: https://share.pluginus.net/image/i20240531181742.png
if ($addon['price'] AND class_exists('WOOCS')) {
global $WOOCS;
$currrent = $WOOCS->current_currency;
if ($currrent != $WOOCS->default_currency AND $WOOCS->is_multiple_allowed) {
$currencies = $WOOCS->get_currencies();
$rate = $currencies[$currrent]['rate'];
$addon['price'] = $addon['price'] * $rate;
}
}Also in the same file add code: https://share.pluginus.net/image/i20240531182106.png
if (class_exists('WOOCS')) {
global $WOOCS;
$currrent = $WOOCS->current_currency;
if ($currrent != $WOOCS->default_currency AND $WOOCS->is_multiple_allowed) {
$currencies = $WOOCS->get_currencies();
$rate = $currencies[$currrent]['rate'];
$addon_price = $addon_price * $rate;
}
}In file wp-content\plugins\woocommerce-product-addons\includes\class-wc-product-addons-display.php add next code: - https://share.pluginus.net/image/i20240603113834.png
$suffix = ''; //woocs fix
$woocs_is_multiple = 0;
if (class_exists('WOOCS')) {
global $WOOCS;
$woocs_is_multiple = $WOOCS->is_multiple_allowed;
}And on the same file add code: - https://share.pluginus.net/image/i20240603113927.png
'woocs_is_multiple' => $woocs_is_multiple
In file wp-content\plugins\woocommerce-product-addons\assets\js\frontend/addons.js add next code: - https://share.pluginus.net/image/i20240531183303.png
var woocs_exists = true;
try {
if (woocs_current_currency)
woocs_exists = true;
} catch (e) {
woocs_exists = false;
}
if (woocs_exists) {
if (woocs_current_currency != undefined AND woocs_current_currency['rate'] != undefined AND woocommerce_addons_params.woocs_is_multiple == 0) {
self.base_price = self.base_price * woocs_current_currency['rate'];
}
}
And on the same file: - https://share.pluginus.net/image/i20240531183404.png
var woocs_exists = true;
try {
if (woocs_current_currency)
woocs_exists = true;
} catch (e) {
woocs_exists = false;
}
if (woocs_exists) {
if (woocs_current_currency != undefined AND woocs_current_currency['rate'] != undefined AND addon_cost != undefined) {
addon_data.cost = addon_data.cost * woocs_current_currency['rate'];
addon_data.cost_raw = addon_data.cost_raw * woocs_current_currency['rate'];
}
}and into file functions.php of the current WordPress theme add next code:
add_filter('woocommerce_product_addons_option_price', function ($price_html, $option, $i, $type) {
if ($price_html AND class_exists('WOOCS')) {
global $WOOCS;$option_price = !empty($option['price']) ? $option['price'] : '';
$option_price_type = !empty($option['price_type']) ? $option['price_type'] : '';
$price_prefix = 0 < $option_price ? '+' : '';
$price_type = $option_price_type;
$price_raw = apply_filters('woocommerce_product_addons_option_price_raw', $option_price, $option);
$price_raw = $WOOCS->woocs_exchange_value($price_raw);
$price_html = '(' . $price_prefix . wc_price(WC_Product_Addons_Helper::get_product_addon_price_for_display($price_raw)) . ')';
}return $price_html;
}, 20, 4);
As for rounding, I already use the necessary rounding code for this. However, this has no effect on the addon prices. - Of course! I wrote to you that you need to customize this code
Please try this:
New code:
In file wp-content\plugins\woocommerce-product-addons\includes\class-wc-product-addons-cart.php add next code: https://share.pluginus.net/image/i20240531181742.png
if ($addon['price'] AND class_exists('WOOCS')) {
global $WOOCS;
$currrent = $WOOCS->current_currency;
if ($currrent != $WOOCS->default_currency AND $WOOCS->is_multiple_allowed) {
$currencies = $WOOCS->get_currencies();
$rate = $currencies[$currrent]['rate'];
$addon['price'] = $addon['price'] * $rate;
}
}
Also in the same file add code: https://share.pluginus.net/image/i20240531182106.png
if (class_exists('WOOCS')) {
global $WOOCS;
$currrent = $WOOCS->current_currency;
if ($currrent != $WOOCS->default_currency AND $WOOCS->is_multiple_allowed) {
$currencies = $WOOCS->get_currencies();
$rate = $currencies[$currrent]['rate'];
$addon_price = $addon_price * $rate;
}
}
In file wp-content\plugins\woocommerce-product-addons\includes\class-wc-product-addons-display.php add next code: - https://share.pluginus.net/image/i20240603113834.png
$suffix = ''; //woocs fix
$woocs_is_multiple = 0;
if (class_exists('WOOCS')) {
global $WOOCS;
$woocs_is_multiple = $WOOCS->is_multiple_allowed;
}
And on the same file add code: - https://share.pluginus.net/image/i20240603113927.png
'woocs_is_multiple' => $woocs_is_multiple
In file wp-content\plugins\woocommerce-product-addons\assets\js\frontend/addons.js add next code: - https://share.pluginus.net/image/i20240531183303.png
var woocs_exists = true;
try {
if (woocs_current_currency)
woocs_exists = true;
} catch (e) {
woocs_exists = false;
}
if (woocs_exists) {
if (woocs_current_currency != undefined AND woocs_current_currency['rate'] != undefined AND woocommerce_addons_params.woocs_is_multiple == 0) {
self.base_price = self.base_price * woocs_current_currency['rate'];
}
}
And on the same file: - https://share.pluginus.net/image/i20240531183404.png
var woocs_exists = true;
try {
if (woocs_current_currency)
woocs_exists = true;
} catch (e) {
woocs_exists = false;
}
if (woocs_exists) {
if (woocs_current_currency != undefined AND woocs_current_currency['rate'] != undefined AND addon_cost != undefined) {
addon_data.cost = addon_data.cost * woocs_current_currency['rate'];
addon_data.cost_raw = addon_data.cost_raw * woocs_current_currency['rate'];
}
}
and into file functions.php of the current WordPress theme add next code:
add_filter('woocommerce_product_addons_option_price', function ($price_html, $option, $i, $type) {
if ($price_html AND class_exists('WOOCS')) {
global $WOOCS;
$option_price = !empty($option['price']) ? $option['price'] : '';
$option_price_type = !empty($option['price_type']) ? $option['price_type'] : '';
$price_prefix = 0 < $option_price ? '+' : '';
$price_type = $option_price_type;
$price_raw = apply_filters('woocommerce_product_addons_option_price_raw', $option_price, $option);
$price_raw = $WOOCS->woocs_exchange_value($price_raw);
$price_html = '(' . $price_prefix . wc_price(WC_Product_Addons_Helper::get_product_addon_price_for_display($price_raw)) . ')';
}
return $price_html;
}, 20, 4);
As for rounding, I already use the necessary rounding code for this. However, this has no effect on the addon prices. - Of course! I wrote to you that you need to customize this code
Quote from nathanot19 on October 11, 2024, 12:39Hi,
That is exactly the same code that is in the topic I referred to. This code is currently implemented in my website, but does not solve the problem.
Addon prices are converted to the correct currency, but not rounded. Also, prices change when an addon is added to the cart.
Kind regards,
Nathan
Hi,
That is exactly the same code that is in the topic I referred to. This code is currently implemented in my website, but does not solve the problem.
Addon prices are converted to the correct currency, but not rounded. Also, prices change when an addon is added to the cart.
Kind regards,
Nathan
Quote from Pablo Borysenco on October 14, 2024, 09:36Hello
Ok! Please drop me exact link to the issue. Describe in more detail what I should do to get the error. Paste ftp access - https://share.pluginus.net/image/i20230222134241.png -> https://share.pluginus.net/image/i20230222134615.png
Addon prices are converted to the correct currency, but not rounded. - Yes of course! As I wrote to you earlier - to round third-party prices you need to customize the code
Hello
Ok! Please drop me exact link to the issue. Describe in more detail what I should do to get the error. Paste ftp access - https://share.pluginus.net/image/i20230222134241.png -> https://share.pluginus.net/image/i20230222134615.png
Addon prices are converted to the correct currency, but not rounded. - Yes of course! As I wrote to you earlier - to round third-party prices you need to customize the code