PluginUs.Net - Business Tools for WooCommerce and WordPress

[realize your idea - make your dreams come true]

Support Forum

You need to log-in to create request (topic) to the support

Add USD or CAD after the price

The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday. If you have problems with registration ask help on contact us page please
If you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.

Howdy!

I am using the [woocs_price id=9727] shortcode to display the product price on my own Wordpress product page.

Is there a way to add USD or CAD after the price, depending on the currency?

$100.00 USD
$100.00 CAD

Hello

You  can try  to add in  functions.php code:

add_filter('woocs_price_shortcode', function($price, $product_o){

global $WOOCS;

return $price ."" . $WOOCS->current_currency;

});

Thanks for the PHP code. I added it to my Code Snippets plugin and activated it.

Unfortunately when activated it breaks the site. I deactivated it and everything is fine again.

Is there a typo in the code?

Hello

Yes. Try  this  code:

add_filter('woocs_price_shortcode', function($price, $product_o){

global $WOOCS;

return $price ."" . $WOOCS->current_currency;

},10,2);

Almost there!!

The price appears as"$ 2,127.06CAD
• There is a space after the"$"   Can this space be removed?
• There needs to be a space before the"CAD".  Can this be added?

Thank you so much

Hello

  1. - please  check  option - https://share.pluginus.net/image/i20211116142747.png
  2.  change the  code:

add_filter('woocs_price_shortcode', function($price, $product_o){

global $WOOCS;

return $price  ."" . $WOOCS->current_currency;

},10,2);

This works perfectly! Thank you so much!

For future reference, all prices in North America have the $ next to the number with no space, and the CAD or USD is always on the right.

Cheers!

Hello

Ok!  Please  try  to  watch  a video - https://currency-switcher.com/video#video_1

All this can be realized if you configure the plugin correctly.