Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save sarancartrabbit/5404e4fb6db7ba2c92f2be9869a58175 to your computer and use it in GitHub Desktop.
Save sarancartrabbit/5404e4fb6db7ba2c92f2be9869a58175 to your computer and use it in GitHub Desktop.
Woo Discount Rules: Quantity based get discount details
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