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

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 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 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!

Hello

Please  read  this - https://currency-switcher.com/hook/woocs_woocommerce_variation_prices

Try to  use:

$price = round($price, 1);

 

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@

Please drop me exact link to the issue

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

 

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

Hi

  1. no, I am not using any third party plugin to change prices.
  2.  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;

    });

  3. 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.

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

Hi. So I should add another snippet on top of previous one? Right?

Thanks for your confirmation

Hi. Would you mind confirming my previous message. Thanks!

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.

Thanks. I wasn't sure what was the difference. Will try now.

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;

});

Great!  Welcome;)