Okay
  Public Ticket #3445939
Discount calculation
Closed

Comments

  •  6
    Wolfgang started the conversation

    Hello!

    I have set up a dynamic rule with a discount of 5%. But in the calculation then only 4.2% discount comes out. Where could be the error?

    I found out that the discount is calculated from the amount without tax. How can I change this?

    Thanks and best wishes.

  •  2,218
    WebWizards replied

    Hello Wolfgang,

    To have rules include tax in the calculation, please add this PHP code snippet to your site:

    add_filter('b2bking_cart_subtotal', function($value){
        
        $value = WC()->cart->get_subtotal() + WC()->cart->get_subtotal_tax();
        return $value;
    }, 10, 1);
    

    A PHP snippet can be added to functions.php, or by following our guide here: https://woocommerce-b2b-plugin.com/docs/how-to-add-a-snippet-php-or-js/


    Let me know if that solves it for you,


    Kind regards,

    Stefan


  •  6
    Wolfgang replied

    Hello Stefan, 

    yes, it works fine.

    Thank you!