• Resolved zoorax

    (@zoorax)


    I am encountering an issue with the “WooCommerce Wrap Product as Gift” plugin on my website. The default currency is set to NPR, with a gift wrap cost of Rs 50. However, when the currency is converted to USD, the Rs 50 is incorrectly converted to $50, instead of approximately $0.30.Could you please assist in resolving this issue?

    Thank you,Sohan Mehta

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Theo Gkitsos

    (@theogk)

    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.

    Plugin Author Pexle Chris

    (@pexlechris)

    Plugin Author Theo Gkitsos

    (@theogk)

    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.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.