skip to Main Content

I have an online store based on Woocommerce. I am looking for a solution to calculate VAT from product price and not on top of "Net price". Example: Product price is $100. I enter product prices incl VAT. So, if customer billing country is Denmark, then Product VAT should be 25% ($20), if country is Ireland, then Product VAT should be 23%($18.70), but order grand total ant product price must be the same $100. Screens below. Any ideas how to do that?

Bulling country Demark

Denmark

Billing country Ireland

enter image description here

2

Answers


  1. Chosen as BEST ANSWER

    I found a simple solution to achieve what I wanted, so I am posting this for someone who will have the same issue.

    function adjust_non_base_price()
    {
        return false;
    }
    add_action('woocommerce_adjust_non_base_location_prices', 'adjust_non_base_price', 99999);
    

  2. WooCommerce > Settings > Tax. This tab is only visible if taxes are enabled.
    Find the ‘Calculate Tax Based On’ option, and select ‘Customer Billing Address’ from the dropdown menu. Click ‘Save changes

    This guide will be helpful: https://woocommerce.com/document/setting-up-taxes-in-woocommerce/

    OR if you want to override hook please try be

    add_action( 'woocommerce_checkout_update_order_review', 'bbloomer_taxexempt_checkout_based_on_zip' );
      
    function bbloomer_taxexempt_checkout_based_on_zip( $post_data ) {
            WC()->customer->set_is_vat_exempt( false );
            parse_str( $post_data, $output );
            if ( $output['billing_postcode'] === '32444' ) WC()->customer->set_is_vat_exempt( true );
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search