Public Ticket #3445939

Discount calculation

Closed
Comments
7 Tickets 6
Wolfgang Saul started the conversation 3 years ago on August 28, 2023 at 10:01am

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,762
KingsPlugins replied 3 years ago on August 29, 2023 at 5:25am

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://b2bkingplugin.com/docs/how-to-add-a-snippet-php-or-js/


Let me know if that solves it for you,

Kind regards,

Stefan

Sign In