I'm working in wordpress with the woocommerce plugin where I wan't to show two different prices on my products.
One as default that is shown as the user gets to the page and one that's shown when the user clicks a button. If he clicks the same button again the previous price should show again. And so on.
So some type of check of what is shown on the page, which could be done in JQuery I guess, but is there any other way? I tried a bit with JQuery but have a bit of problems using it with woocommerce.
<?php
$incl = $product->get_price_including_tax();?>
<p id="excl" class="price"><?php echo $product->get_price_excluding_tax();?> excl.</p>
<button type="button" onclick="document.getElementById('excl').innerHTML = <?php echo $incl;?>">Click Me!</button>
That does the one way around but needs the previous mentioned check in order to be used the other way around again.
And a extra question: those incl and excl tax call ruin the settings done in the admin end with the formatting of prices. So 6.000,00 for instant becomes 6000. I tried woocommerce_price which works but is deprecated. Is there a similar function to do that? Can't find anything in the documentation.