Hello, this free plugin does not support currency conversion out of the box. But there is a way to achieve this using some code.
You have to use the following filter to change the cost depending on user selected currency:
add_filter('pre_option_tgpc_gift_wrapper_cost', function($cost){
// 1. Detect active currency (USD or NPR)
// 2. If USD is selected, convert cost to USD using exchange rate
return $cost;
});
The above is an example; you have to make some modifications to make it work. I don’t know how familiar you are with writing code. Maybe if you tell me which plugin you are using for currency conversion, I can further help you.
I am currently using FOX – Currency Switcher Professional for WooCommerce for currency convert
Plugin Link: https://currency-switcher.com/#google_vignette
If you could provide a complete code then it would be very helpful.
Hello @sohannnn, you should first update the plugin to the latest version (v1.2.3) and then add this code to your functions.php file or a Code snippets plugin:
add_filter('tgpc_wc_gift_wrapper_cost', function( $cost ) {
global $WOOCS;
if ( ! isset($WOOCS) || ! $WOOCS->is_multiple_allowed ) return $cost;
$current = $WOOCS->current_currency;
if ($current !== $WOOCS->default_currency) {
$currencies = $WOOCS->get_currencies();
$rate = $currencies[$current]['rate'];
$cost = $cost * $rate;
}
return $cost;
});
Let me know if this worked for you.