Created
May 21, 2024 12:11
-
-
Save sarancartrabbit/5404e4fb6db7ba2c92f2be9869a58175 to your computer and use it in GitHub Desktop.
Woo Discount Rules: Quantity based get discount details
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_action('woocommerce_get_price_html', function($html, $product) { | |
$quantity = 5; | |
$discount_details = apply_filters('advanced_woo_discount_rules_get_product_discount_details', false, $product, $quantity); // it's product object for 3rd parameters | |
if ($discount_details !== false) { | |
print_r($discount_details); // If product has discount get the discount details | |
} | |
return $html; | |
}, 10, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment