Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Woo Discount Rules: Woocommerce currency switcher by realmag777 - Compatible while having fixed price rule instread of currency value in currency switcher
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;
global $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->default_currency) && isset($WOOCS->current_currency)){
if($WOOCS->default_currency != $WOOCS->current_currency){
$convert = true;
return $convert;
}, 10);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.