woocommerce how in checkout to add my custom field check box, and when i check it hide the shipping adress and add tax 19% [closed]

CLARIFICATION FOR ALL :

You use virtual products on your shop.

On checkout page, you have created and set an additional checkbox for european VAT purpose.

There is 3 cases related to this checkbox.

  1. Checkbox is hidden (default)
  2. Checkbox is visible when selected country is an european
    country:

    • Checkbox disabled (default) => set the VAT value to ‘0’
      (vat is not applied).
    • Checkbox enabled:
      1. VAT is applied normally
      2. Hide (unset) all fields in billing details except email field and country selector.

WHAT IS NOT WORKING

Your php functions related to checkbox detection state, because you use $_POST['my_checkbox'] but you don’t post (submit) anything, you have just an enable/disable state on a form item.

WHAT DO YOU NEED TO DO (not done yet) :

  1. Define the european countries => Visible checkbox state
  2. You need to use javascript/jQuery .select() form event for detection and Ajax in javascript and wordpress.

    Read this article: 5 TIPS FOR USING AJAX IN WORDPRESS.
    You can search and find a lot of related stuff to wordpress ajax and form element detection state over this forum threads.