Okay
  Public Ticket #3740127
VAT Validation and zero VAT Problem
Closed

Comments

  •  3
    Gökhan started the conversation

    Hello,

    I found a bug/issue with the plugin. I have a B2B shop where I want customers to see prices without taxes. For this, I use dynamic rules, and this works fine. I also have some B2B customers in other countries with valid VAT numbers. I want only these customers to be able to order without taxes, but I want the VAT number to be checked again at the time of order.

    To achieve this, I added another dynamic rule. Normally, this works too, but only if I deactivate the other rule. The two rules do not work together correctly. My B2B customers in other countries are being charged VAT again, and the option to order without VAT doesn’t work.

    I’m sending you screenshots of the rules. Please take a look. I think we might need to set priorities for these rules, but the priority field is inactive, and I don’t understand why. Could you please check this?

    Best regards,

    Attached files:  rules.JPG
      rules for price shows without vat.JPG
      rule for order without vat.JPG

  •  2,243
    WebWizards replied

    Hello Gökhan,

    Those rules are in conflict with each other - they cannot really work together that way I'm afraid.

     

    I believe we can help achieve the desired setup with a code snippet.

    To make sure I understand correctly:

    • Is the idea that you want the group B2B MWST FREI to see prices ex tax on shop pages, but see the price with tax in cart. And then check their VAT nr on the checkout page to possibly remove VAT completely?

    You mentioned:

    but I want the VAT number to be checked again at the time of order.

    • Normally B2BKing will check the VAT number only once (once it's added, it's saved as valid to the user profile). Are you saying you want to re-check it again whenever an order is placed? B2BKing doesn't have a feature for it, but we could add a code snippet to remove it and force the customer to add it / validate it again when placing each order. Would that work for you?

     

    Kind regards,

    Stefan

  •  3
    Gökhan replied

    Hello,

    Yes, that works so that B2B customers, when logged in, can see prices without VAT and then see VAT added in the cart. This setup works fine.

    However, making it so that a customer group (B2B-MWST FREI) can see prices without VAT and also not pay VAT in the cart (since they are in Europe and have a valid VAT number) doesn’t work together with the other setup.

    And actually, your plugin does have the function to check the VAT number again during the checkout process, which also works fine.


    Best Regards

  •  3
    Gökhan replied

    Hello,


    you want to send me code snipped? And?


    Best Regards

  •  2,243
    WebWizards replied

    Hi again,

    I believe you can achieve it as follows:

     

    1. Remove B2B Mwst Frei from this rule: https://prnt.sc/QpVoszm2Y0-a

    2. Add this PHP snippet to your site:

    add_filter( 'option_woocommerce_tax_display_cart', 'mwst_frei_price_ex_tax', 10000 );
    add_filter( 'option_woocommerce_tax_display_shop', 'mwst_frei_price_ex_tax', 10000 );
    
    function mwst_frei_price_ex_tax($val){
    	
    	$user_id = get_current_user_id();
    	$user_id = b2bking()->get_top_parent_account($user_id);
    
    	$currentusergroupidnr = b2bking()->get_user_group($user_id);
    	$group_name = get_the_title($currentusergroupidnr);
    
    	if ($group_name === 'B2B (Mwst Frei)'){
    		return 'excl';
    	}
    
    	return $val;
    }
    

    I believe it should allow the other rule to work without conflicts.

    This code can be added to functions.php, or to any code snippets plugin.

     

    If this does not work for you, could you clarify what exactly happens for the group Mwst frei vs what should happen. Or share a site access so we can check it directly?

     

    Kind regards,

    Stefan

  •  3
    Gökhan replied

    Hello,


    Yes it looks to work, thank you


    Best Regards