I wrote this code (on woocommerce/single-product/price.php) a few months ago but I lost it, I was lucky to recover the code but in its first phase. Before the result gave me a thousand separation, I think it was because of the "preg_replace" function.
<?php echo '$' . round((preg_replace('/^[\.]/', '', $product->get_price()) *1.04)); ?>
The result that shows me is similar to: $311896. The format I'm looking for: $311.896
I will show you how it works. I add a tax to a payment gateway (that's why I used formula x1.04). It is shown in this way: The original price if it is formatted correctly, but my code is not. It is a headache.