"Woocommerce currency switcher by realmag777 - Compatible while having fixed price rule instread of

Ensure compatibility with Woocommerce currency switcher by realmag777, particularly with fixed price rules instead of currency values.

function woocs_fixed_raw_woocommerce_price_method($tmp_val, $product_data, $price){
    remove_filter('woocs_fixed_raw_woocommerce_price', 'woocs_fixed_raw_woocommerce_price_method', 10, 3);
    global $flycart_woo_discount_rules;
    if(!empty($flycart_woo_discount_rules)){
        global $product;
        if(empty($product)){
            $discount_price = $flycart_woo_discount_rules->pricingRules->getDiscountPriceOfProduct($product_data);
            if($discount_price !== null) $tmp_val = $discount_price;
        }
    }
    add_filter('woocs_fixed_raw_woocommerce_price', 'woocs_fixed_raw_woocommerce_price_method', 10, 3);

    return $tmp_val;
}
add_filter('woocs_fixed_raw_woocommerce_price', 'woocs_fixed_raw_woocommerce_price_method', 10, 3);

//The bellow snippet should be used only if the discount value is not correct in cart even after the above snippet is added.(From v1.7.13)
add_filter('woo_discount_rules_woocs_convert_price_based_on_currency', function($convert){
	global $WOOCS;
	if(isset($WOOCS)){
		if (isset($WOOCS->default_currency) && isset($WOOCS->current_currency)){
			if($WOOCS->default_currency != $WOOCS->current_currency){
				$convert = true;
			}
		}
	}
	return $convert;
}, 10);