So here’s how I did it for my theme. I presume that this may work for most themes, but no guarantee.
You will need 2 plugins. This one and the “PHP Code For Posts” plugin. That that plugin does is it allows you to turn snippets of PHP code or really any code into a shortcode.
So, once you’ve installed that plugin, go in and make a snippet/shortcode using the following code…
<?php
$price = get_post_meta($postid = get_the_ID(), 'price', true);
$number = money_format('%.2n', $price);
?>
<span class="wlt_shortcode_price"><?php echo do_shortcode( "[wpcs_price value='$number']" );?></span>
– where “$price” and ” ‘price’ ” are whatever variable your theme uses as the price variable for your products. My theme happens to use “$price”.
– where wlt_shortcode_price is the css class for your price field on your theme.
Save that snippet/shortcode. Now you should have a snippet/shortcode called [php snippet=1]
Install the WP currency Switcher plugin and set up your currencies how you want them and place the [wpcs show_flags=0 width=’300px’ txt_type=’desc’] shortcode of the plugin where ever you want it to appear on your site.
Then, wherever your price shortcode appears in your code for your theme, replace that with the [php snippet=1] shortcode you just made and voila, your prices will now be controlled by currency switcher.
It works great for me on my theme. The only thing to note is that it will not add a thousands separator to your prices so if you have high priced items them this may bother you. I have tried many variations of PHP does to place the thousands separator in the price and I cannot figure it out. You can’t use the setlocale(LC_MONETARY, 'en_US')
code but that messes up WP Currency Switcher. You have to let WP Currency switcher dictate the local money format, not the php code of the theme.