Show Trailing Zeroes on WooCommerce Products Prices

From WooCommerce 2.1 (2.1.3 to be precise) the trailing zeros has been removed from the products prices. This has been implemented using a function (woocommerce_price_trim_zeros) which removes the trailing zeros. Not, this make senses in many ways. Then again if you want to have the zeros to be displayed, there are simple solution available.

add_filter('woocommerce_price_trim_zeros','display_trailing_zeros', 10, 1);
function display_trailing_zeros($trim){
   return false; }

In this snippet all we are doing is adding a filter with the function which returns no value forcing WC to follow the traditional path of displaying zeros. This is as simple as it can get. All you need to do now is to simply copy and paste the snippet mentioned above on your theme's functions.php age and update it. You should be good to go.

Reference: add_filter.


Commenting is disabled.