Created
February 1, 2023 13:03
-
-
Save sarancartrabbit/6d859abb98f1d8b99c1ce6a61a3835d5 to your computer and use it in GitHub Desktop.
Discount rules v2: Product based get discount price
This file contains 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_filter('wc_add_to_cart_message_html', function ($message, $products, $show_qty){ | |
foreach ( $products as $product_id => $qty ) { | |
$product = wc_get_product( $product_id); | |
$product_price = $product->get_price(); | |
$discount = apply_filters('advanced_woo_discount_rules_get_product_discount_price_from_custom_price', $product_price, $product, $qty, $product_price, 'discounted_price', false, true); | |
if($discount !== false) { | |
$message .= " Discounted price: ". $discount; //HERE YOU GET DISCOUNTED PRICE | |
} | |
} | |
return $message; | |
}, 10, 3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment