Last active
November 10, 2021 13:16
-
-
Save AshlinRejo/c8863a8a302cec68abc2118f3a2ef0f0 to your computer and use it in GitHub Desktop.
Discount rules v2: Change priority of variable strikeout and display only minimum price
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('advanced_woo_discount_rules_after_initialize', function() { | |
if(class_exists('\Wdr\App\Router')){ | |
remove_filter('woocommerce_variable_price_html', array(\Wdr\App\Router::$manage_discount, 'getVariablePriceHtml'), 100); | |
add_filter('woocommerce_variable_price_html', array(\Wdr\App\Router::$manage_discount, 'getVariablePriceHtml'), 10000, 2); | |
} | |
}); | |
add_filter('advanced_woo_discount_rules_strikeout_price_html', function($html, $original_price, $discounted_price, $is_variable_product){ | |
if($is_variable_product){ | |
return "Fr: " .str_replace("<br>", ' ', $html); | |
} else { | |
return $html; | |
} | |
}, 10, 4); | |
add_filter('advanced_woo_discount_rules_format_sale_price_range', function($html, $min_price, $max_price, $original_html){ | |
return wc_price($min_price); | |
}, 10, 4); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment