• Resolved Leandro

    (@leandroprz)


    I set my store in US dollars but I want to convert to Argentine pesos in the checkout, so I’m using the Gateways Currency Converter Module.

    I’m also using this code to convert currency symbols to my needs:

    // Change WooCommerce currency symbol (https://docs.woocommerce.com/document/change-a-currency-symbol/)
    add_filter('woocommerce_currency_symbol', 'change_existing_currency_symbol', 10, 2);
    
    function change_existing_currency_symbol( $currency_symbol, $currency ) {
         switch( $currency ) {
              case 'ARS': $currency_symbol = 'ARS';
              break;
    
              case 'USD': $currency_symbol = 'US$';
              break;
         }
         return $currency_symbol;
    }

    Here’s the issue: when I enable Gateways Currency Converter Module, it overrides my code for both ARS and USD.

    I need to show to the customer that the price in USD is being converted to ARS. Any way to keep the plugin from touching my code?

    • This topic was modified 6 years, 7 months ago by Leandro.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi Leandro,

    You can change the currency symbol using “Price formats” module – that way the currency symbol would be consistent in your site and it wouldn’t be overridden.

    Thread Starter Leandro

    (@leandroprz)

    I enabled that module but now I’m getting the currency code + the $ symbol.
    Is it possible to get just the currency code?

    Hi Leandro,

    I’m sorry, I meant the “All currencies” module. You should be able to change the currency symbols there, so if it is currency code + $ in that module, you should be able to quickly change that. Let me know if it’s not.

    Thread Starter Leandro

    (@leandroprz)

    Too bad that module doesn’t have any free options to enable. Are there any plans to add one or two maybe to the free version of the plugin?

    Hi Leandro,

    Could you please try this code for your issue:

    add_action( 'init', 'add_filter_change_existing_currency_symbol', PHP_INT_MAX );
    function add_filter_change_existing_currency_symbol() {
    	add_filter( 'woocommerce_currency_symbol', 'change_existing_currency_symbol', PHP_INT_MAX, 2 );
    }
    function change_existing_currency_symbol( $currency_symbol, $currency ) {
    	switch( $currency ) {
    		case 'ARS': $currency_symbol = 'ARS';
    		break;
    
    		case 'USD': $currency_symbol = 'US$';
    		break;
    	}
    	return $currency_symbol;
    }
    Thread Starter Leandro

    (@leandroprz)

    It’s working perfectly. Thank you!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Gateways Currency Converter Module is overriding my custom currency symbol’ is closed to new replies.