
Under General Settings in WooCommerce Settings screen, you will find options to set your store Currency, Currency position, Decimal separator and Number of decimals for your store. Here Number of decimals allows you to Choose the number of digits to appear after the decimal separator.
Based on selected option, it will display prices through out your website with decimals (like $ 121.00). In order to remove decimals from displaying in your product price, add below code in functions.php file of your website theme.
add_filter( 'woocommerce_price_trim_zeros', '__return_true' );
8 responses
If you want decimal but don’t want to show .00 values, then this function can be used to trim the zero values.
add_filter( ‘woocommerce_price_trim_zeros’, ‘__return_true’ );
Add this into the functions.php.
Thanks Deb.
This will be helpful.
Just what i was looking for, thank you!
Excelent!! Thanks
it worked for me thank you
thank you!
THANK YOU
Thanks. I added the code to a client site, but after a customer use a coupon code, the total price has 2 decimals. See image: https://trenza.se/wp-content/uploads/2022/03/code-tack15.jpg