Home / functions.php / Show trailing zeros on prices in WooCommerce
  • How to Show trailing zeros on prices in WooCommerce

    show-trailing-zeros-on-prices-in-woocommerce

    Since WooCommerce 2.1 trailing zeros on prices has been removed. So if you want ti have trailing zeros adding to your pricing be sure to add this snippet to the functions.php of your wordpress them.

    ( click code to copy )

    wordpress snippet : PHP

    <>
    add_filter( 'woocommerce_price_trim_zeros', 'wc_hide_trailing_zeros', 10, 1 );
    function wc_hide_trailing_zeros( $trim ) {
        // set to false to show trailing zeros
        return false;
    }
    

    ( WordPress codex functions, hooks, in this snippet. )

    add_filter,