Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Woo Discount: Get sale price from Woo Discount Rules
function woocommerce_product_get_sale_price_from_woo_discount_rules($value, $product){
if(!is_admin()){
global $flycart_woo_discount_rules;
if(!empty($flycart_woo_discount_rules)){
$discounted_price = $flycart_woo_discount_rules->pricingRules->getDiscountPriceOfProduct($product);
if($discounted_price !== null){
$value = $discounted_price;
}
}
}
return $value;
}
add_filter('woocommerce_product_get_sale_price', 'woocommerce_product_get_sale_price_from_woo_discount_rules', 10, 2);
add_filter('woocommerce_product_variation_get_sale_price', 'woocommerce_product_get_sale_price_from_woo_discount_rules', 10, 2);
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.