What I Want

I want to display the prices in the product page exactly as inputed. So for eg: if for a product I give price as 70.000 and another price as 70. I want to display exactly as entered. So regular price for first will be displayed as 70.000 and for second product price will be displayed as 70.

The reason for this is for certain products I want to display the decimal points and for some I don't want decimal points. So setting decimal point to 3 in woocommerce settings to 3 is not an option.

What I Tried

I tried modifying wc_price function in wc-formatting get_price_html function in absctract-wc-product.php

But it seems like the price is formatted before. How can I achieve this? I'm new to wordpress and would like some help.

closed as off-topic by fuxia Apr 12 '17 at 13:03

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.


Try using get_price() instead of get_price_html(). You can call the function on any woocommerce template like this


Not the answer you're looking for? Browse other questions tagged or ask your own question.