WooCommerce Show Trailing Zeros on Prices

One of the changes that was made with the refinement of the WooCommerce Settings in WooCommerce 2.1 was the removal of the option to show trailing zeros after prices.

Pre WooCommerce 2.1 there was a checkbox you could check to show the prices with trailing zeros, this was removed and replaced with a filter instead.

In order to display trailing zeros on your prices add the code below to your theme’s functions.php file


<?php
// Show trailing zeros on prices, default is to hide it.
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;
}
?>

view raw

functions.php

hosted with ❤ by GitHub