WOOCS - WooCommerce Currency Switcher

Enhanced Ecommerce Google Analytics for WooCommerce by TheDotStore

Plugin URL: https://www.thedotstore.com/woocommerce-enhanced-ecommerce-analytics-integration-with-conversion-tracking/

  • to file wp-content\plugins\woo-ecommerce-tracking-for-google-and-facebook\public\class-advance-ecommerce-tracking-public.php add next code:
    if (class_exists('WOOCS')) {
        global $WOOCS;
        $currencies = $WOOCS->get_currencies();
        $_order_currency = get_post_meta($order_id, '_order_currency', true);
        $order_rate = get_post_meta($order_id, '_woocs_order_rate', true);
        if (!$order_rate) {
            if (isset($currencies[$_order_currency])) {
                $order_rate = $currencies[$_order_currency]['rate'];
            } else {
                $order_rate = 1;
            }
        }
        if ($_order_currency != $WOOCS->default_currency) {
            $orders_detail['order_sub_total'] = $WOOCS->back_convert($orders_detail['order_sub_total'], $order_rate, 2);
            $orders_detail['shipping_total'] = $WOOCS->back_convert($orders_detail['shipping_total'], $order_rate, 2);
            $orders_detail['order_total'] = $WOOCS->back_convert($orders_detail['order_total'], $order_rate, 2);
            $orders_detail['tax'] = $WOOCS->back_convert($orders_detail['tax'], $order_rate, 2);
            $orders_detail['coupon_discount'] = $WOOCS->back_convert($orders_detail['coupon_discount'], $order_rate, 2);
        }
    }

  • in file wp-content\plugins\woo-ecommerce-tracking-for-google-and-facebook\public\class-advance-ecommerce-tracking-public.php add next code:
    if (class_exists('WOOCS')) {
        global $WOOCS;
        $current_currency = $WOOCS->current_currency;
        if ($WOOCS->default_currency != $current_currency) {
            $WOOCS->reset_currency();
        }
    }

  • and to the same file add next code:
    if (class_exists('WOOCS')) {
        global $WOOCS;
    
        if ($WOOCS->current_currency != $current_currency) {
            $WOOCS->set_currency($current_currency);
        }
    }