WooCommerce: same price regardless of taxes

In my online shop, customers from the EU have to pay their country’s VAT rate. Customers from the USA, for example, do not have to pay any VAT. If I set the price to 15 Euros in WooCommerce and specify that the prices include taxes, the default behavior is the following:

Customers from a country for which a tax rate is specified pay 15 Euros including their country’s tax rate. Customers from countries without a specified tax rate pay less than 15 Euros. I am not sure, but I think in this case the price is reduced by the tax rate from the shop’s base location. The desired effect is that these customers pay 15 Euros too, but without any included taxes.

The WooCommerce wiki on GitHub has the solution for that. You only have to insert the following line of code into your theme or into a plugin:

add_filter( 'woocommerce_adjust_non_base_location_prices', '__return_false' );
Code language: JavaScript (javascript)

24 reactions on »WooCommerce: same price regardless of taxes«

  1. Hi Florian,

    Where exactly should this code be inserted in WordPress? Somehow I cannot make my way thru this... Custom CCS does not work so it must be some other place..?

    Best regards,
    Jonne

    1. Hi Jonne,

      yes, that is a PHP snippet. You can insert it into the functions.php file of your theme (if you are not using a custom theme, you should create a child theme for that, so you do not loose the modification if the theme gets an update) or into a small plugin.

      Hope that helps,
      Florian

  2. Hi
    I just used this filter, defined the tax for US to 10%, the product price was 1000 and the tax calculated was 90.91. Any idea why tax is not calculated as 100?
    Thanks
    Jesper

  3. Perfect! Thank you so much. Spent several days trying to solve this by changing various setting in WooCommerce and installing different plugins, but this code did the trick. Thank you!

  4. Hi,
    how can i display the tax in the cart. With your snippet, it works perfectly except that i only see the tax for one country. If i switch the country in the cart. the tax is not shown.

  5. Finally found out how to do this, thanks a lot!!

    How would you reckon taxes behave when I connect WooCommerce backend to a marketplace tool like Channable/Channelengine? These tools upload the products from Woocommerce to all kinds of marketplaces.

    Im guessing this will be a pain to get the price to stay the same, no?

  6. I used this filter it worked for the tax calculation as said, but messed up with my price calculations on the order details page and emails that is sent to the customers. It somehow deducts installment fees on the order page, which I do not reflect to customers and they shouldn’t see these fees at all. Anybody had a problem like that?

          1. I will check, but I need that plugin as well so I guess I will have to find another solution for taxes. I’m new to wordpress, it’s amazing what you can do, but it’s a little frustrating that you need paid plugins or snippets for every little thing you want to add. And this tax calculation of woocommerce is really not practical. My site is multicurrency that may cause the problem as well I suppose.

  7. hallo florian,

    great very usefull snippet. do you know how i can exclude countries like switzerland and norway? (0% tax)

    i have entered in the products incl. tax – for the EU tax change on 1st july i want to use the incl. tax price for all countries – with this snippet it works the way i want it. just by switzerland and norway it does show the price incl. tax. so i want to exclude these two countries in the snippet.

    thanks + schöne grüsse
    oli

  8. hey florian,

    i want to use this function. i am facing the problem, that in EU countries it works, but when shipping to a non EU-country (like switzerland) it does not use the 0% tax i have set up.

    i found a function for this, but then facing the prolem that it does not work proper in EU countries (sight)

    add_action( 'woocommerce_cart_calculate_fees', 'same_price_for_eu' );
    function same_price_for_eu(){

    $countries = new WC_Countries();

    $eu_countries = $countries->get_european_union_countries();

    if ( in_array( WC()->customer->get_shipping_country(), $eu_countries) ){
    add_filter( 'woocommerce_adjust_non_base_location_prices', '__return_false');

    } else {
    remove_filter( 'woocommerce_adjust_non_base_location_prices', '__return_false');

    }
    }
    any ideas? i try to use add_action( 'woocommerce_before_calculate_totals', too but does not work.

    sos!

    thanks
    oli

    1. Hi Oli,

      sorry, but I cannot help you there. I am not working much with WooCommerce and did not have this problem.

      Hope you find a solution.

      Best,
      Florian

Leave a Reply

Your email address will not be published. Required fields are marked *