Okay
  Public Ticket #3051307
Dynamic Rules - set value 'How much' and determine is net (excluding_tax) or gross (including_tax) value
Closed

Comments

  •  1
    Tom started the conversation

    DYNAMIC RULES:
    I would like to set value 'How much' including_tax OR excluding_tax (for discounts rule types: Discount Percentage, Discount Amount, Fixed Price etc.).
    Example:
    - b2c discount -> set product fixed price 10$ (including_tax)
    - b2b discount -> set product fixed price 10$ (excluding_tax)

  •  2,286
    WebWizards replied

    Hi there,

    I don't think we can add this directly in rules, because this is very dependent on your WooCommerce tax settings.


    1) Generally, to display prices excluding tax for B2B and including tax for B2C, you can use our guide here: 

    https://woocommerce-b2b-plugin.com/docs/how-to-display-prices-excluding-tax-for-b2b-users-and-including-tax-for-b2c-users/


    2) There is also the following setting that determines if prices are considered entered as including tax or excluding tax:


    4759209832.png


    You can change the value of this for B2B users. For example to set it to 'No' for B2B users, you can use the following code snippet:

    add_filter('option_woocommerce_prices_include_tax', function($val){
        $user_id = get_current_user_id();
        $is_b2b = get_user_meta($user_id,'b2bking_b2buser', true);
        if ($is_b2b === 'yes'){
            $val = 'no';
        }
        return $val;
    }, 10, 1);
    


    Kind regards,

    Stefan