Title: Working with multiple currency
Last modified: November 14, 2022

---

# Working with multiple currency

 *  Resolved [spartakg](https://wordpress.org/support/users/spartakg/)
 * (@spartakg)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/working-with-multiple-currency/)
 * Hi.
 * Is there any way to make Gift wrapper plugin to work with multiple currencies.
   I am using WOOCS – WooCommerce Currency Switcher on my site and when selecting
   Gift wrapper on the checkout page the added sum is always on the default currency.
 * thank you

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/topic/working-with-multiple-currency/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/working-with-multiple-currency/page/2/?output_format=md)

 *  Plugin Author [Pexle Chris](https://wordpress.org/support/users/pexlechris/)
 * (@pexlechris)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/working-with-multiple-currency/#post-16197786)
 * This plugin adds fees with method add_fee.
    `WC()->cart->add_fee( $fee_name, 
   $fee_cost, $is_taxable, $tax_class );`
 * So this function adds fee in the current currency.
 * I have tested in a test website:
 * Product: [https://test.pexlechris.dev/product/test-15-kg/](https://test.pexlechris.dev/product/test-15-kg/)
   
   Checkout: [https://test.pexlechris.dev/checkout/](https://test.pexlechris.dev/checkout/)
   Currency Switcher: in Footer
 * and works fine (at the current currency)
 *  [Little Package](https://wordpress.org/support/users/littlepackage/)
 * (@littlepackage)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/working-with-multiple-currency/#post-16198395)
 * Hi [@pexlechris](https://wordpress.org/support/users/pexlechris/)
 * Thanks for your great question. There’s always a way, and I like this idea; however,
   I’ve been sick and not focusing on development of this free plugin. If you hire
   someone to fix this up for you I’d be happy to take a look and maybe incorporate
   it.
 *  Thread Starter [spartakg](https://wordpress.org/support/users/spartakg/)
 * (@spartakg)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/working-with-multiple-currency/#post-16200092)
 * Hi.
    Ok thank you. I wish you a fast recovery.
 *  Thread Starter [spartakg](https://wordpress.org/support/users/spartakg/)
 * (@spartakg)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/working-with-multiple-currency/#post-16200669)
 * Hi Pexle. Maybe it doesn’t work with my currency plugin ‘WOOCS – WooCommerce 
   Currency Switcher’.
    Can you have a look here: [https://erozone.innovatech.al/](https://erozone.innovatech.al/)
 * My default currency is ALL and the gift wrapper fee is set to 150 ALL. When switching
   to Euro it stays 150 Eur.
 * thank you
 *  [Little Package](https://wordpress.org/support/users/littlepackage/)
 * (@littlepackage)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/working-with-multiple-currency/#post-16201118)
 * [@spartakg](https://wordpress.org/support/users/spartakg/) This plugin is so 
   similarly named to [the one I maintain](https://wordpress.org/plugins/woocommerce-gift-wrapper/),
   so I got confused here. Never mind what I said earlier. WOOCS might or might 
   not work with the Gift Wrapper – not tested.
 *  Plugin Author [Pexle Chris](https://wordpress.org/support/users/pexlechris/)
 * (@pexlechris)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/working-with-multiple-currency/#post-16201345)
 * [@spartakg](https://wordpress.org/support/users/spartakg/) In my test site I 
   use also plugin ‘WOOCS – WooCommerce Currency Switcher’.
 * And I can see in your website that when currency is euro, and gift wrapper is
   checked, I can see in the fees:
    Gift wrapper 150.00€ Also when the other currency
   is checked and Gift wrapper is also checked I can see in fees: Gift wrapper L
   150
 * This is how should work and works! So what is the problem?
    Can you provide a
   screenshot here (with the help of some external service, maybe cloud storage 
   such as Google Drive)?
 * Thanks
 *  Thread Starter [spartakg](https://wordpress.org/support/users/spartakg/)
 * (@spartakg)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/working-with-multiple-currency/#post-16201398)
 * [@pexlechris](https://wordpress.org/support/users/pexlechris/) Hi.
 * No L 150 is around 1.29 eur. So at euro currency it should convert to around 
   1.29 eur but it stays 150 eur.
    If you notice the product amount converts ok 
   when switching currency but gift wrapper amount does not convert.
 * Do you want access to my test website ?
 *  Plugin Author [Pexle Chris](https://wordpress.org/support/users/pexlechris/)
 * (@pexlechris)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/working-with-multiple-currency/#post-16201408)
 * Now I understood the case,
    You can ask the currency Plugin how manage the cart
   fees Or change it with a php hook.
 * Do you want help with the hook?
 *  Thread Starter [spartakg](https://wordpress.org/support/users/spartakg/)
 * (@spartakg)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/working-with-multiple-currency/#post-16201437)
 * You said that you also use ‘WOOCS – WooCommerce Currency Switcher’. Have you 
   done any customization or hook in your case or just works for you?
 * I will write to the currency plugin developers. I would also appreciate your 
   help until I get a response from them. Is the hook a solid solution?
 *  Plugin Author [Pexle Chris](https://wordpress.org/support/users/pexlechris/)
 * (@pexlechris)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/working-with-multiple-currency/#post-16202267)
 * You can see in my test site how it works. I think that dont convert the euro 
   to dollars and vice versa, as you wan. Just changes the symbols €, $
 * Yes, you can use the filter `pre_option_tgpc_gift_wrapper_cost` to change fee
   cost.
 *     ```
       add_filter('pre_option_tgpc_gift_wrapper_cost', function($fee){
          if( $currency == 'dollars' ){ // you need to find out from currency plugin how to get current currency
             $fee = $fee*1.2; // Your calculation
          }
          return $fee;
       });
       ```
   
 * The above hook is just an example
 *  Thread Starter [spartakg](https://wordpress.org/support/users/spartakg/)
 * (@spartakg)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/working-with-multiple-currency/#post-16203438)
 * Hi Pexle.
    Where do I add this hook ?
 * thank you
 *  Plugin Author [Pexle Chris](https://wordpress.org/support/users/pexlechris/)
 * (@pexlechris)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/working-with-multiple-currency/#post-16203473)
 * To add this hook, you can read this blog post:
    [How to add PHP Hooks in your WordPress Site](https://www.pexlechris.dev/how-to-add-php-hooks-in-your-wordpress-site/)
 * But have in mind that this hook will not work as it is.
 * To get the current currency, maybe this function will work
 *     ```
       function pex_get_current_currency(){
          $currency = do_shortcode('[woocs_show_current_currency text=""]');
          $currency = strip_tags($currency);
          $currency = trim($currency);
          $currency = trim($currency, '&nbsp;');
          return $currency;
       }
       ```
   
    -  This reply was modified 3 years, 5 months ago by [Pexle Chris](https://wordpress.org/support/users/pexlechris/).
      Reason: trim
 *  Thread Starter [spartakg](https://wordpress.org/support/users/spartakg/)
 * (@spartakg)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/working-with-multiple-currency/#post-16206579)
 * Hi. I was able to find the WOOCS code to get the currency rate:
 *     ```
       if (class_exists('WOOCS')) {
           global $WOOCS;
           $currencies = $WOOCS->get_currencies();
           $currrent = $WOOCS->current_currency;
          $rate = $currencies[$currrent]['rate'];
       }
       ```
   
 * in the case of ALL rate is 1, in the case of EUR my rate is 0.008.
    So the gift
   fee should be $fee * rate.
 * I tried to implement the following code but it returns 0 for both currencies.
 * add_filter(‘pre_option_tgpc_gift_wrapper_cost’, function($fee){
    $fee = $fee*
   $rate ; return $fee; });
 *  Plugin Author [Pexle Chris](https://wordpress.org/support/users/pexlechris/)
 * (@pexlechris)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/working-with-multiple-currency/#post-16209444)
 *     ```
       if (class_exists('WOOCS')) {
           global $WOOCS;
           $currencies = $WOOCS->get_currencies();
           $currrent = $WOOCS->current_currency;
          $rate = $currencies[$currrent]['rate'];
       }
       ```
   
 * In my site $rate returns 1. Maybe this is the default value and the problem.
 * The filter that you can use is
 *     ```
       add_filter('pre_option_tgpc_gift_wrapper_cost', function($fee){
       	if( class_exists('WOOCS') ) {
       		global $WOOCS;
       		$currencies = $WOOCS->get_currencies();
       		$currrent = $WOOCS->current_currency;
       	    $rate = $currencies[$currrent]['rate'];
       		if( $currrent == 'USD' ){ // you need to find out from currency plugin how to get current currency
       			$fee = $fee*$rate; // Your calculation
       		}
       	}
   
          return $fee;
       });
       ```
   
 *  Thread Starter [spartakg](https://wordpress.org/support/users/spartakg/)
 * (@spartakg)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/working-with-multiple-currency/#post-16210931)
 * I think the $fee variable has no value. I applied and returned zero. So I tried
   to manually put the $fee = 150 and it worked.
 *     ```
       add_filter('pre_option_tgpc_gift_wrapper_cost', function($fee){
       	if( class_exists('WOOCS') ) {
       		global $WOOCS;
       		$currencies = $WOOCS->get_currencies();
       		$currrent = $WOOCS->current_currency;
       	    $rate = $currencies[$currrent]['rate'];
       		if( $currrent == 'EUR' ){ // you need to find out from currency plugin how to get current currency
       			$fee = 150*$rate; // Your calculation
       		}
       	}
   
          return $fee;
       });
       ```
   
 * Thank you very much for giving me the direction to the solution. Here is the 
   list of woocs functions if you ever need it.
    [https://currency-switcher.com/codex/#code](https://currency-switcher.com/codex/#code)
 * br
    Spartak

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/topic/working-with-multiple-currency/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/working-with-multiple-currency/page/2/?output_format=md)

The topic ‘Working with multiple currency’ is closed to new replies.

 * ![](https://ps.w.org/gift-wrapping-for-woocommerce/assets/icon-256x256.png?rev
   =2669367)
 * [Gift Wrapping for WooCommerce](https://wordpress.org/plugins/gift-wrapping-for-woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/gift-wrapping-for-woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/gift-wrapping-for-woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/gift-wrapping-for-woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/gift-wrapping-for-woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/gift-wrapping-for-woocommerce/reviews/)

 * 16 replies
 * 3 participants
 * Last reply from: [Pexle Chris](https://wordpress.org/support/users/pexlechris/)
 * Last activity: [3 years, 5 months ago](https://wordpress.org/support/topic/working-with-multiple-currency/page/2/#post-16210967)
 * Status: resolved