If you are using WooCommerce Product Add-Ons (https://woocommerce.com/products/product-add-ons/), you will need the following code snippet to include the product add-on price as well for the discount.

Snippet 1: 

Use the following snippet if you see the prices of add-ons displaying as 0 in the cart page or it does not display at all

if(!function_exists('woo_discount_rules_has_price_override_method')){
    function woo_discount_rules_has_price_override_method($hprice, $product){
        return true;
    }
}
add_filter('woo_discount_rules_has_price_override', 'woo_discount_rules_has_price_override_method', 10, 2);


Snippet 2: 

If you does not want the add-on prices to be considered in the discount rule  AND you want the discount apply only on the main product's price.

Click the button below to see the snippet 

How to Add the Code Snippet:

Method 1: Easier (Recommended)

Using our compatibility plugin. (It's a useful plugin)

Method 2: 

Using the Code Snippet plugin.

Note: 

  • You need to follow any one of the above methods (DO NOT follow Method 2 if you already followed Method 1)

I have more questions

Just leave your question and email by clicking the Live Chat button below or submit your support request to [email protected]

We are always happy to assist you :)

Did this answer your question?