WOOCS - WooCommerce Currency Switcher

Product Bundles – by SomewhereWarm

Plugin link: https://woocommerce.com/products/product-bundles/

  • in file \wp-content\plugins\woocommerce-product-bundles\includes\class-wc-pb-product-prices.php add code:
    if (class_exists('WOOCS')) {
        global $WOOCS;
        if ($WOOCS->current_currency != $WOOCS->default_currency) {
            $currencies = $WOOCS->get_currencies();
            if ($WOOCS->is_multiple_allowed) {
                $discounted_price = $discounted_price / $currencies[$WOOCS->current_currency]['rate'];
            }
        }
    }

  • in file \wp-content\plugins\woocommerce-product-bundles\includes\class-wc-pb-display.php  add code:
    $is_multiple = 1;
    if (class_exists('WOOCS')) {
        global $WOOCS;
        if (!$WOOCS->is_multiple_allowed) {
            $is_multiple = 0;
            $suffix = "";
        }
    }

  • and this code line: ‘woocs_is_multiple’=> $is_multiple
  • in file \wp-content\plugins\woocommerce-product-bundles\assets\js\add-to-cart-bundle.js add code:
    /*woocs*/
    if (woocs_current_currency != undefined && woocs_current_currency['rate'] != undefined && wc_bundle_params.woocs_is_multiple==0) {
        price = wc_pb_number_round(price * woocs_current_currency['rate']);
    }

  • in file \wp-content\plugins\woocommerce-product-bundles\templates\single-product\bundled-item-optional.php  add code add code:
    if (class_exists('WOOCS')) {
        global $WOOCS;
        $_price = $bundled_item->product->get_price();
        if ($WOOCS->current_currency != $WOOCS->default_currency) {
            $currencies = $WOOCS->get_currencies();
            if ($WOOCS->is_multiple_allowed) {
                $price_html = $WOOCS->wc_price($_price / $currencies[$WOOCS->current_currency]['rate'], false);
            }
        }
    }


Old adaptation: https://currency-switcher.com/product-bundles-woocommerce/