I think people should be able to format the add-on prices on the front end. If an add on costs $5, i would rather it show $5 instead of $5.00. The extra .00 just takes up unnecessary space, especially when the website is scaled down for mobile responsiveness
Closed
Last updated: April 19, 2023
Log in to comment on this feature request.
Hey there,
Thank you for reaching out!
The number of decimals that show up in frontend prices is determined by the WooCommerce > Settings > General > Currency options > Number of decimals option: https://d.pr/i/aiYqht.
If this is set to 2, then all prices in your store will show up with 2 digits. If a price is not a decimal, then 0 digits will be added instead. This also happens if you create a Simple Product and assign a non-decimal price to it.
To remove trailing zeros from prices, you may use the following PHP snippet:
add_filter( 'woocommerce_price_trim_zeros', '__return_true' );
To install PHP snippets like the above, I recommend using the Code Snippets plugin: https://wordpress.org/plugins/code-snippets/