How can I round a price for the USD currency
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 mariangio on March 16, 2023, 14:30Hi
I would like to round the price to the nearer 10cents. If the price is 12.67 I would like the price to be 12.7. If it is 25.41 the price should be shown like 25.4
I have tried that snippet but not working as I would like it:
add_filter('woocs_raw_woocommerce_price', function($price) {
global $WOOCS;
if($WOOCS->current_currency=="USD") {
$price = round($price * 2, 1) / 2;
}return $price;
});
Also seems it is not working on variable products (https://soulonpurpose.com.au/shop/?currency=USD)
Can you help. Thanks!
Hi
I would like to round the price to the nearer 10cents. If the price is 12.67 I would like the price to be 12.7. If it is 25.41 the price should be shown like 25.4
I have tried that snippet but not working as I would like it:
add_filter('woocs_raw_woocommerce_price', function($price) {
global $WOOCS;
if($WOOCS->current_currency=="USD") {
$price = round($price * 2, 1) / 2;
}
return $price;
});
Also seems it is not working on variable products (https://soulonpurpose.com.au/shop/?currency=USD)
Can you help. Thanks!
Quote from Pablo Borysenco on March 17, 2023, 10:29Hello
Please read this - https://currency-switcher.com/hook/woocs_woocommerce_variation_prices
Try to use:
$price = round($price, 1);
Hello
Please read this - https://currency-switcher.com/hook/woocs_woocommerce_variation_prices
Try to use:
$price = round($price, 1);
Quote from mariangio on March 17, 2023, 10:38Thanks for your reply,
I have tried that as suggested :
add_filter('woocs_raw_woocommerce_price', function($price) {
global $WOOCS;
if($WOOCS->current_currency=="USD") {
$price = round($price, 1);
}return $price;
});
but it doesn't do anything.
can you help. Thanks@
Thanks for your reply,
I have tried that as suggested :
add_filter('woocs_raw_woocommerce_price', function($price) {
global $WOOCS;
if($WOOCS->current_currency=="USD") {
$price = round($price, 1);
}
return $price;
});
but it doesn't do anything.
can you help. Thanks@
Quote from Pablo Borysenco on March 17, 2023, 12:46Please drop me exact link to the issue
Please drop me exact link to the issue
Quote from mariangio on March 20, 2023, 12:13https://soulonpurpose.com.au/shop/?currency=USD
Here is the page. As you can see the prices are still 9.27usd or 8.54usd.
I am trying to have those 9.3usd (instead of 9.27) or 8.5 (instead of 8.54)
Thanks
https://soulonpurpose.com.au/shop/?currency=USD
Here is the page. As you can see the prices are still 9.27usd or 8.54usd.
I am trying to have those 9.3usd (instead of 9.27) or 8.5 (instead of 8.54)
Thanks
Quote from Pablo Borysenco on March 20, 2023, 12:24Hello
Please update the plugin to latest version
Are you using any third party plugin to change the price?
Are you using the second hook? - https://currency-switcher.com/hook/woocs_woocommerce_variation_prices
What are your tax settings? - https://share.pluginus.net/image/i20230320122335.png
Hello
Please update the plugin to latest version
Are you using any third party plugin to change the price?
Are you using the second hook? - https://currency-switcher.com/hook/woocs_woocommerce_variation_prices
What are your tax settings? - https://share.pluginus.net/image/i20230320122335.png
Quote from mariangio on March 20, 2023, 12:30Hi
- no, I am not using any third party plugin to change prices.
- I am using that hook only:add_filter('woocs_raw_woocommerce_price', function($price) {
global $WOOCS;
if($WOOCS->current_currency=="USD") {
$price = round($price, 1);
}return $price;
});
- I didn't have the tax options activated. I just activated it to arrive to your screenshot and enter price are inclusive taxes and display withtaxes.
Hi
- no, I am not using any third party plugin to change prices.
- I am using that hook only:add_filter('woocs_raw_woocommerce_price', function($price) {
global $WOOCS;
if($WOOCS->current_currency=="USD") {
$price = round($price, 1);
}return $price;
});
- I didn't have the tax options activated. I just activated it to arrive to your screenshot and enter price are inclusive taxes and display withtaxes.
Quote from Pablo Borysenco on March 20, 2023, 14:082) Please add this hook - https://currency-switcher.com/hook/woocs_woocommerce_variation_prices - for variable products
3) better turn it off because taxes are calculated after this hook
2) Please add this hook - https://currency-switcher.com/hook/woocs_woocommerce_variation_prices - for variable products
3) better turn it off because taxes are calculated after this hook
Quote from mariangio on March 20, 2023, 14:09Hi. So I should add another snippet on top of previous one? Right?
Thanks for your confirmation
Hi. So I should add another snippet on top of previous one? Right?
Thanks for your confirmation
Quote from mariangio on March 21, 2023, 09:33Hi. Would you mind confirming my previous message. Thanks!
Hi. Would you mind confirming my previous message. Thanks!
Quote from Pablo Borysenco on March 21, 2023, 11:59Hello
You should use those two hooks - https://currency-switcher.com/hook/woocs_woocommerce_variation_prices and https://currency-switcher.com/hook/woocs_raw_woocommerce_price
One hook changes the prices of simple products, the second for variable ones.
Hello
You should use those two hooks - https://currency-switcher.com/hook/woocs_woocommerce_variation_prices and https://currency-switcher.com/hook/woocs_raw_woocommerce_price
One hook changes the prices of simple products, the second for variable ones.
Quote from mariangio on March 21, 2023, 12:24Thanks. I wasn't sure what was the difference. Will try now.
Thanks. I wasn't sure what was the difference. Will try now.
Quote from mariangio on March 21, 2023, 12:29Thanks so much it works. For info I enter to have the price on single and variable rounded. Works great. Thanks again
add_filter('woocs_raw_woocommerce_price', function($price) {
global $WOOCS;
if($WOOCS->current_currency=="USD") {
$price = round($price, 1);
}return $price;
});
add_filter('woocs_woocommerce_variation_prices', function($price) {
global $WOOCS;
if($WOOCS->current_currency=="USD") {
$price = round($price, 1);
}
return $price;});
Thanks so much it works. For info I enter to have the price on single and variable rounded. Works great. Thanks again
add_filter('woocs_raw_woocommerce_price', function($price) {
global $WOOCS;
if($WOOCS->current_currency=="USD") {
$price = round($price, 1);
}
return $price;
});
add_filter('woocs_woocommerce_variation_prices', function($price) {
global $WOOCS;
if($WOOCS->current_currency=="USD") {
$price = round($price, 1);
}
return $price;
});
Quote from Pablo Borysenco on March 21, 2023, 13:38Great! Welcome;)
Great! Welcome;)