On website the prices must be displayed without decimals, but I need to display decimals in the invoice.
For example, Product1 price displayed on website is $ 15. If I change the general settings to hide decimals it will hide decimals in invoice as well, and I need it to be $ 15.00
Is there any way I can do that?
Thanks, Nicu.
If you just wanna do that you can do it by woocommerce settings. Just go to admin dashboard->woocomerce->setting->Genrak tab look for currency option and set Number of decimals.
Running any number through the function woocommerce_price() will format that number with the number of decimals, thousands separator, currency symbol and currency location chosen in the admin.
Add the function to your code snippet should format the price correctly:
<?php if ( $price_html = $product->get_price_including_tax() ): ?>
<span class="price"><?php echo woocommerce_price($price_html); ?></span>
Source: https://wordpress.stackexchange.com/questions/106355/how-to-display-price-including-tax-with-formatting
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With