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

Rounding prices

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’m trying to automatically round all product prices in my WooCommerce store to whole numbers. I’ve already tried the solutions from the documentation, but none of them seem to work correctly in my setup.

Could you please provide a safe code snippet that I can add to my functions.php file to achieve proper price rounding?

Hello

To round all prices to whole numbers, add this code to your theme's functions.php file:

// Round all converted prices to whole numbers
add_filter('woocs_exchange_value', function($price) {
    return round($price, 0);
}, 9999);

Alternative options:

If you want to always round UP (to avoid losing profit):

add_filter('woocs_exchange_value', function($price) {
    return ceil($price);
}, 9999);

Or round to nearest 5 or 10 for cleaner prices:

// Round to nearest 5 (23.4 → 25)
add_filter('woocs_exchange_value', function($price) {
    return round($price / 5) * 5;
}, 9999);

Important: Clear all caches (site cache, page cache, browser cache) after adding the code.

Read also: https://currency-switcher.com/search?s=round

Let me know if this works for you!

Hello,

unfortunately, this solution does not work on our side.

You can see the issue here:
https://srv94019.seohost.com.pl/kategoria-produktu/rozwiazania-holograficzne/

Prices are still not being rounded as expected after adding the code and clearing all caches.

Please let me know what else we can check or adjust.

Hello

Ok, lets review this link https://srv94019.seohost.com.pl/produkt/box/ - prices are 5,399.00 zł – 33,899.00 zł - how do you want to round them, describe please by links and prices desription (how is, and how to be)

As it stage site you can share wp-admin acess there in the private access of this ticket

https://share.pluginus.net/image/i20230222134241.png
https://share.pluginus.net/image/i20230222134615.png
https://share.pluginus.net/image/i20230222134511.png

Hello,

Thank you for the details.

To clarify, the PLN prices are not rounded by any rule or conversion — they are manually set as fixed, already rounded values, and they are correct as they are.

The issue appears only when switching the currency in the top-right corner:

Current situation

  • PLN → prices are fixed and intentionally set (not rounded automatically)

  • USD / EUR → prices are calculated by direct conversion and therefore are not rounded

Expected behavior

  • PLN → no change

  • USD / EUR → apply rounding rules after conversion so the prices display as clean, rounded values

Once rounding is applied for foreign currencies, pricing will be consistent and more user-friendly.

We can share wp-admin access to the staging site via the private section of this ticket if needed.

Hello

Looks like my bad, wrong hooks, I just added to functions.php file ( https://srv94019.seohost.com.pl/wp-admin/theme-editor.php?file=functions.php&theme=astra ):

add_filter('woocs_raw_woocommerce_price', function($price) {
return round($price, 0);
});

add_filter('woocs_woocommerce_variation_prices', function($price) {
return round($price, 0);
});

And its works, for example: https://srv94019.seohost.com.pl/produkt/box/ please check it"  "

 

 

 

Thank you!
You should consider adding this option to the plugin.