Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AshlinRejo/24b5334058421979f99d5b164cc8a23c to your computer and use it in GitHub Desktop.
Save AshlinRejo/24b5334058421979f99d5b164cc8a23c to your computer and use it in GitHub Desktop.
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);
@seldimi
Copy link

seldimi commented Jan 9, 2023

This one has stopped working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment