WOOCS - WooCommerce Currency Switcher

WordPress Appointment Booking Plugin by bookingWP

Plugin URL: https://bookingwp.com/plugins/woocommerce-appointments/

  • to file wp-content\plugins\woocommerce-appointments\includes\class-wc-appointment-cart-manager.php add next code:
    if (class_exists('WOOCS')) {
        global $WOOCS;
        if ($WOOCS->current_currency != $WOOCS->default_currency) {
            $currencies = $WOOCS->get_currencies();
            if ($WOOCS->is_multiple_allowed) {
                $rate = $currencies[$WOOCS->current_currency]['rate'];
                $cart_item_meta['appointment']['_cost'] = $cart_item_meta['appointment']['_cost'] / $rate;
            }
        }
    }

  • to file wp-content/plugins/woocommerce-appointments/includes/integrations/woocommerce-product-addons/includes/class-wc-product-addons-cart.php add next code:
    if (class_exists('WOOCS')) {
        global $WOOCS;
        $addon['price'] = $WOOCS->woocs_exchange_value(floatval($addon['price']));
    }

  • to your current child wp theme file functions.php add next code:
    add_filter('woocommerce_product_addons_option_price_raw', function ($option_price, $option) {
    
        if (class_exists('WOOCS')) {
            global $WOOCS;
            $option_price = $WOOCS->woocs_exchange_value(floatval($option_price));
        }
    
        return $option_price;
    }, 10, 2);