A scenario where a client wanted the currency conversion to work on a Pagebuilder text widget /module. Let’s take for example the client has a text Shipping starts from $50 added using WP bakery text module and expected $50 to reflect the conversion rate based on the site currency or switched by the user.
Add this code to theme functions.php
<pre>add_shortcode( ‘wcml_price’, ‘wcml_price_func’ );
function wcml_price_func( $atts ) {
extract (shortcode_atts( array(
‘price’ => ”,
), $atts ));
$price = apply_filters( ‘wcml_formatted_price’, $price );
return $price;
}
</pre>
Usage: the shortcode [wcml_price price=”50″] in the text module as Shipping starts from [wcml_price price=”50″]
Caveat: This works only with the WCML > Multicurrey, is set up with conversion rates, Cannot be used for manual secondary pricing
Support Thread Example
Let us know if this snippet is not working for you:
This snippet doesn’t work