Sales tax being charged everywhere, not just in base state.

Hello
I have tried asking about this though live chat but still having the same issue.

I have run marketpress for a couple years on http://www.sikhfoundation.org.
We only charge sales tax to people in the same state as the foundation. This was never a problem with marketpress before - as long as I set the base state. But as of a few months ago, sales tax is being added everywhere. I have tried different states and countries and any order I try now shows tax.

I have been told by live chat that this was never a feature. That marketpress never allowed tax for just the base state. But I know it has.

I even found this, an older post - where one of the heads up in the company say it is a function.
https://premium.wpmudev.org/forums/topic/charge-tax-only-for-in-state-orders
Look for Aarons response.

This issue has been unresolved, and even when I tried another fix - having paypal charge the tax instead of marketpress -- the tax that paypal tried to add seems to get removed after a person is set back to the store for the final review of their order before submitting.

Please help with this - it is getting very frustrating for myself and the foundation.

I keep wordpress updated - just did the latest one tonight
I have Version 3.0.0.7 of Marketpress
Using Hueman as a theme.
I have granted support access as well

Thank you

  • Dimitris

    Hello there Miz Cozma,

    hope you're doing good today! :slight_smile:

    I've also tried to replicate this in a test site of mine. I've setup the same store base as your site, using California state, and after making a purchase with billing/shipping address outside of USA, the taxes applied normally.

    I believe that this is default functionality, but in order to be 100% sure about it, so I can also learn if this has to be treated like a bug or a feature request, I've contacted one of the developers working on MarketPress and I'm waiting for some feedback, as he seems to be offline currently.

    Me or another colleague of mine will keep you posted here, as soon as we've got some valuable insights! Your patience is highly appreciated!

    Warm regards,
    Dimitris

  • Dimitris

    Hey again Miz Cozma,

    the following snippet is removing all taxes for non-Californians. Please add it in a new MU plugin file like /wp-content/mu-plugins/mp-remove-taxes.php (simply create the /mu-plugins/ folder, if it doesn't exist).

    <?php
    add_filter( 'mp_tax_rate', function( $rate ){
    
      $state    = mp_get_user_address_part( 'state', 'shipping' );
      $country  = mp_get_user_address_part( 'country', 'shipping' );
    
      if ( empty( $country ) ) {
          $country = mp_get_setting( 'base_country' );
      }
    
      if ( empty( $state ) ) {
          $state = mp_get_setting( 'base_province' );
      }
    
      if( $country != 'US' || $state != 'CA' ){
          $rate = 0;
      }
    
      return $rate;
    
    }, 10, 1 );

    Warm regards,
    Dimitris

  • Miz Cozma

    So I am not sure if I am doing something wrong but i tried these things

    I made the mu-pluugins folder in /wp-content/
    I created the mp-remove-taxes.php and pasted in your code

    I tested the site and the code appeared at the top of the main page. oops

    So I moved the mu-plugins folder to plugins and made sure it was set to 755

    The coded left the top of the front page but when I tried both a Canadian address and a California address both show tax.

    Also I noticed that the tax shows on the very first step of the checkout, before signing in or shopping as guest.

    Hope this information helps

    oh I also tried adding ?> at the end of the code but still tax everywhere

    C

  • Dimitris

    Hello Miz Cozma

    Please do double check that you're using the exact lines in your MU plugins file. First ensure that there's no empty lines or/and space before the opening PHP tag (<?php) and this should be enough.

    Path should be: wp-content/mu-plugins/mp-remove-taxes.php

    The closing PHP tag in the end of file, shouldn't cause any issues, even if you remove it, just like my example.

    Let me know how that goes! :slight_smile:

    Take care,
    Dimitris

  • Miz Cozma

    So I checked the file - I did have one space after the closing - so removed that.
    I copied the orginal text you posted and pasted it into the php file I created - it pasted all together so I divided the lines as you have them.

    <?php 
    
    add_filter( 'mp_tax_rate', function( $rate ){
    
    $state = mp_get_user_address_part( 'state', 'shipping' );
    
    $country = mp_get_user_address_part( 'country', 'shipping' );
    
    if ( empty( $country ) ) { 
    
    $country = mp_get_setting( 'base_country' );
    
    }
    
    if ( empty( $state ) ) {
    
    $state = mp_get_setting( 'base_province' );
    
    if( $country != 'US' || $state != 'CA' ){ 
    
    $rate = 0; 
    
    }
    
    return $rate;
    
    }, 10, 1 );

    I tried it again with mu-plugins in the plugins folder.. still same issue

    I moved the mu-plugins into the wp-content as you said - and still I see the code at the top of the pages.. including screen shot. I tried to move forward with the code on top and I still saw tax on a Canadian address - but when I tried updating the shipping part then the page didn't refresh the wait spinner kept spinning..

    so what do we try next :slight_smile:

  • Dimitris

    Could you please share some server credentials to have a closer look? :slight_smile:
    As this is public forum, you should send us your details through our safe contact form https://premium.wpmudev.org/contact/#i-have-a-different-question using this template:

    Subject: "Attn: Dimitris"
    - WordPress admin (login url/username/password)
    - FTP credentials (host/username/password)
    - link back to this thread for reference
    - any other relevant urls

    Keep in mind the subject line as ensures that it gets assigned to me.

    Warm regards,
    Dimitris

  • Dimitris

    Hello there Miz Cozma,

    hope you're doing good today! :slight_smile:

    I've just went ahead and inserted this MU plugin file in your server.
    I can see no code displaying in frontend, and using a guest user to place an order, the taxes were removed from totals after setting my address outside of US, just before hitting Paypal's end.
    Could you please confirm that this is working good now?

    Warm regards,
    Dimitris