WOOCS - WooCommerce Currency Switcher

Aramex Shipping WooCommerce

The plugin URL: https://wordpress.org/plugins/aramex-shipping-woocommerce/

  • In file functions.php of your current wordpress theme add next code:
    add_filter('woocommerce_shipping_method_add_rate_args', function($arg, $obj) {
        if (stristr($arg['id'], '_aramex') !== FALSE AND $arg['cost']) {
            if (class_exists('WOOCS')) {
                global $WOOCS;
                if ($WOOCS->is_multiple_allowed) {
                    $currrent = $WOOCS->current_currency;
                    if ($currrent != $WOOCS->default_currency) {
                        $currencies = $WOOCS->get_currencies();
                        $rate = $currencies[$currrent]['rate'];
                        $arg['cost'] = $arg['cost'] / $rate;
                    }
                }
            }
        }
        return $arg;
    }, 2, 100);