I'm running a currency switching widget on my international woocommerce store. Im working on some jquery to prepend the country code to the price. So instead of the price displaying as $500, it will display as USD$500, and update when the user changes currency.
It works fine up until the click. console.log ( newcurrency );
logs the correct country code on click, but the next line doesn't work.
$(function() {
// Get current currency
var currency = $( ".currency_switcher .active" ).text();
// Add currency before price
$( ".woocommerce-Price-amount" ).prepend( currency );
//On click, update currency
$( ".currency_switcher li a" ).click(function() {
var newcurrency = $(this).text();
console.log ( newcurrency );
$( ".woocommerce-Price-amount" ).prepend( newcurrency );
});
});
Any thoughts why that line isn't working?