Home / Blog / E-commerce
,

Remove decimals from Product prices in WooCommerce

First published 20 Aug 2017. Tested again in November 2026 on WordPress 7.1.4, WooCommerce 11.2.2 and PHP 8.4.

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 lets you choose the number of digits to appear after the decimal separator.

Based on the selected option, it will display prices throughout your website with decimals (like $121.00). To remove decimals from every price, set Number of decimals to 0 in WooCommerce > Settings > General.

If you only want to hide a trailing .00, add the code below to the functions.php file of your theme. It shows $121.00 as $121, while a price with cents, such as $121.50, keeps its decimals.

add_filter( 'woocommerce_price_trim_zeros', '__return_true' );

View or fork this snippet on GitHub Gist.

Want this checked on your own site? See Exivon Tech’s Website & E-commerce Audit.

Dhiren Patel

Principal Full-Stack Engineer · Founder, Exivon Tech

I’ve built and run enterprise web platforms and e-commerce for 13 years, and I built ShieldScope, a free WordPress security scanner.

6 responses to “Remove decimals from Product prices in WooCommerce”

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

    1. Dhiren Patel

      Thanks Deb.
      This will be helpful.

  2. mediapath

    Just what i was looking for, thank you!

  3. james

    it worked for me thank you

  4. Richard

    thank you!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.