FOX - WooCommerce Currency Switcher Professional

WPC Composite Products for WooCommerce By WPClever

Plugin link: https://wordpress.org/plugins/wpc-composite-products/

Signal is sent: https://wordpress.org/support/topic/compatibility-with-fox-currency-switcher-professional-for-woocommerce-2/

  • in file  wp-content\plugins\wpc-composite-products\includes\class-wooco.php add next code (2 places):
    if (class_exists('WOOCS') AND $cart_item['wooco_price'] > 0) {
        global $WOOCS;
        $cart_item['wooco_price'] = $WOOCS->woocs_exchange_value(floatval($cart_item['wooco_price']));
    }
    

  • into file functions.php of the current WordPress theme add next code:
    add_filter('wooco_product_price', function ($price_display, $product, $qty, $price) {
        if (class_exists('WOOCS') AND $price_display > 0) {
            global $WOOCS;
            $price_display = $WOOCS->woocs_exchange_value(floatval($price_display));
        }
        return $price_display;
    }, 10, 4);
    
    add_filter('wooco_product_regular_price', function ($org_price, $product, $qty, $price) {
        if (class_exists('WOOCS') AND $org_price > 0) {
            global $WOOCS;
            $org_price = $WOOCS->woocs_exchange_value(floatval($org_price));
        }
        return $org_price;
    }, 10, 4);
    
    add_filter('wooco_product_new_price', function ($new_price, $product, $qty, $price) {
        if (class_exists('WOOCS') AND $new_price > 0) {
            global $WOOCS;
            $new_price = $WOOCS->woocs_exchange_value(floatval($new_price));
        }
        return $new_price;
    }, 10, 4);
    
    add_filter('wooco_product_price_html', function ($price_html, $product, $qty, $price) {
        if (class_exists('WOOCS') AND $price > 0) {
            global $WOOCS;
            $price_html = wc_price($WOOCS->woocs_exchange_value(floatval($price)));
            //$price_html = wc_format_sale_price( wc_get_price_to_display( $product, [ ‘price’ => $price_ori ] ), $price_display);
        }
        return $price_html;
    }, 10, 4);