Okay
  Public Ticket #3687817
VAT ID is cached.
Closed

Comments

  • Marcin started the conversation

    Hello,

    Pass for wbesite:

    l: inpeak

    p:ENKJ7khWnv37ZdG

    The problem is if anybody put EU VAT ID and validate it by clicking "Validate Button" the information about Tax Exempt is cached. In new session when client want to buy from the same web-brwoser and don't put the VAT IT in field the Tax is exempted ... 

  •  2,114
    WebWizards replied

    Hello Marcin,

    Thank you for purchasing our plugin,


    Indeed this Vat Exempt status is normally saved to the customer's account - the idea is to save time for the customer so they do not have to enter that info again.


    I think we can help with a code snippet here to remove that status if you prefer that. My question is about when to remove that status. Would you like to remove it whenever the user logs out, or whenever an order is finalised successfully, perhaps every 24 hours?

    We could also do it based on the 'wc_session_expiration' hook - I think that's set to last 48 hours by default.


    Kind regards,

    Stefan

  • Marcin replied

    Or maybe adopt a completely different strategy. Because at the moment, if the VAT ID is collected and the customer does not provide it in the form, we will still change the price by VAT, but the VAT ID will not be visible in the order details.

    Is it possible to set up such a strategy that the tax will be removed only when the correct VAT ID is entered? Can it verify itself when it is entered and the field has been left?
    When VAT DI is deleted from the field, tax will also be removed from the price. Nothing will be cached. Simple and stable solution. 

  •  2,114
    WebWizards replied

    Because at the moment, if the VAT ID is collected and the customer does not provide it in the form, we will still change the price by VAT, but the VAT ID will not be visible in the order details.

    During checkout, if a VAT is validated, the VAT number would normally be saved to the user profile, and would always show there in checkout and in order details / invoices, (even if the customer comes back to the page later or in a different session)

    5397354023.png

    I am not sure if you have a different setup on your site somehow, or something else is interfering. 

    It might help if we can check the site directly. I tried viewing the site at inpeak.tech using " l: inpeak p:ENKJ7khWnv37ZdG" but it does not seem to allow me access. If you can share a backend access, that would be great, so we can check configurations as well.


    Is it possible to set up such a strategy that the tax will be removed only when the correct VAT ID is entered? Can it verify itself when it is entered and the field has been left?

    Normally the VAT nr would be saved and displayed there persistently. We could add a "X" / "Clear" button if that would helps, so the customer can remove it easily.

  •   Marcin replied privately
  •   WebWizards replied privately
  • Marcin replied

    Sorry, 

    please try 

    login: wp

    password: wp

  •  2,114
    WebWizards replied

    Thank you, that worked now.


    I've been looking into this and the possible options.

    Generally, the plugin saves that VAT value and VAT-exempt status, because for example we need it on product pages to show the prices without VAT for vat-exempt users. The only way this can work is if the vat-exempt status is saved / cached, as we cannot run the VAT check on each page load. It's also needed to remove the VAT value during the checkout itself. So not saving it at all does not seem like an option.

    What we can do is to remove the VAT number and VAT-exempt status with a code snippet, based on a specific trigger.

    I've set up a snippet here that removes it when an order is placed:

    https://inpeak.tech/wp-admin/admin.php?page=edit-snippet&id=10 (for future reference, the code is https://pastecode.io/s/zn0y49en )


    This way, for the next order, the customer would have to add it again. That seems to work as expected:

    https://www.loom.com/share/6cbd0a1ac0494abbad31f937bb64e63f?sid=64d68cfd-3bf8-4913-8540-49f19044f0be


    If you'd like, I can change the snippet to work based on a different trigger (instead of placing an order), such as a specific amount of time passed, or the wc_session_expiration hook.


  • Marcin replied

    Ok, thank you so much for code snippet that works perfectly. 

    I have also another question. is any option to move "VAT Numer" field to other postion on checkout page ?

  •  2,114
    WebWizards replied

    Glad to hear that's working!


    I have also another question. is any option to move "VAT Numer" field to other postion on checkout page ?

    There's no built-in setting for this, but I can certainly add a code snippet to move it. Just let me know where you'd like to place it, and I will make the change / send you the snippet.

  • Marcin replied

    Hello, next to the company name field.

  •  2,114
    WebWizards replied

    Sure, I've added a code snippet to the site to do that. For future reference, the code is: https://pastecode.io/s/2p62v9rz


    After adding that, I now see the VAT field next to the company one:

    5404002808.png


    I also moved the VALIDATE button inside the VAT field to keep it more compact.


    Kind regards,

    Stefan


  • Marcin replied

    Ok, but when i selec the country from Select the VAT field moves to end of the fields list. Something doesnt work here. Please try to select few country and see thet VAT field mover to random places. Meybe it depend to Country string length ... I don know. 

  •  2,114
    WebWizards replied

    Oh, sorry about that, didn't notice it.

    I've made changes to the snippet to adjust for that. I believe it's now working: https://www.loom.com/share/4e60e8049d7f4d8aad9d9e93df8e364e?sid=7b6e2454-ca60-4007-8c54-2dba1c25114c

    Let me know if you see any further issues,

  • Marcin replied

    Hello, I have add new group. Then during import price in Wp All Import i can not see the new fielc acossiated with thit this group price. 

  •  2,114
    WebWizards replied

    Hi again,

    Sometimes WP All Import may not show a field, especially if it has not been used before.

    If it's not pre-filled as an option, then the meta key of the field has to be entered manually.


    I understand you're importing group prices.

    For group pricing, there are 2 meta keys that can be used:

    - b2bking_regular_product_price_group_GROUPID

    - b2bking_sale_product_price_group_GROUPID  

    Example

    If you set the product meta key b2bking_regular_product_price_group_222 = 199, then B2B users in the group with ID 222 will see the product's price as $199.


    I do not have the the WP ALL Import interface in front of me, but there should be an option there to enter a custom key, please look for that. 

    Let me know if you cannot find it - if so, I will try to run a test import and look for that,