Forums / Currencies & Sales Taxes, VAT, GST, etc. / creating tax exempt status for wholesale customers?

creating tax exempt status for wholesale customers?

Views: 5,002

Results 1 to 15 of 15
8 Sep 2011, 6:37 PM
#1
delia avatar

delia

Totally Zenned

Join Date:
May 2006
Location:
Gardiner, Maine
Posts:
2,383
Plugin Contributions:
7

creating tax exempt status for wholesale customers?

Based on another old thread, I have added this line to the function_taxes.php right after the global db line

if ($_SESSION['customer_whole'] != '0') {
      return 0;
    } 

I printed the sessions and this does exist:
[customer_whole] => 1

But it's still adding tax. What am I missing here? This sounds like it should work.

The full-time Zen Cart Guru. WizTech4ZC.com
New template for 2.0 viewable here: 2.0 Demo

12 Sep 2011, 4:59 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: creating tax exempt status for wholesale customers?

There are many functions in that file. Which one are you referring to? What exactly are you wanting to accomplish?

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

12 Sep 2011, 5:52 PM
#3
delia avatar

delia

Totally Zenned

Join Date:
May 2006
Location:
Gardiner, Maine
Posts:
2,383
Plugin Contributions:
7

Re: creating tax exempt status for wholesale customers?

oops, sorry!

zen_get_tax_rate so that the first of the functions reads like this: ```
function zen_get_tax_rate($class_id, $country_id = -1, $zone_id = -1) {

global $db;

if ($_SESSION['customer_whole'] != '0') {
return 0;
}


Trying to override the sales tax if the customer is wholesale and charge then no tax.

Thanks!

The full-time Zen Cart Guru. WizTech4ZC.com
New template for 2.0 viewable here: 2.0 Demo

12 Sep 2011, 5:58 PM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: creating tax exempt status for wholesale customers?

If $_SESSION doesn't contain 'customer_whole' then you've got a problem elsewhere that's preventing it from being set. It won't be related to the code in that function.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

12 Sep 2011, 6:09 PM
#5
delia avatar

delia

Totally Zenned

Join Date:
May 2006
Location:
Gardiner, Maine
Posts:
2,383
Plugin Contributions:
7

Re: creating tax exempt status for wholesale customers?

The session does contain it though. ```
[customer_country_id] => 223
[customer_zone_id] => 12
[customer_whole] => 1

The full-time Zen Cart Guru. WizTech4ZC.com
New template for 2.0 viewable here: 2.0 Demo

12 Sep 2011, 6:31 PM
#6
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: creating tax exempt status for wholesale customers?

Then try a few different things:
a) 0 is not the same as '0'. 0 is a number. '0' is a string.
b) typecasting the session var as int might be good too

ie: ```
if ([B]COLOR="Red"[/COLOR][/B]$_SESSION['customer_whole'] [B]> 0[/B] ) {


PHP is pretty tolerant to those though, so I wouldn't be surprised if making the change doesn't make much difference, despite the suggested change being better written.


Have you looked at the various tax-exempt addons to see what they're doing? Maybe your approach is missing various other components involved.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

12 Sep 2011, 6:55 PM
#7
delia avatar

delia

Totally Zenned

Join Date:
May 2006
Location:
Gardiner, Maine
Posts:
2,383
Plugin Contributions:
7

Re: creating tax exempt status for wholesale customers?

All of the other tax exempt mods use a separate table to store the customers in - each customer has to be designated as tax exempt separately so I was wanting to do a one time swoop for all of them instead.

Is the logic sound? Seems to me it should work, ie if the customer is wholesale, return 0 for taxes? (I may be showing my php ignorance here)

I tried your suggestion and a few of my own ideas but no dice. I took the idea for this from here

http://www.zen-cart.com/forum/showthread.php?t=115212&highlight=wholesale+groups+tax+exempt

:frusty:

The full-time Zen Cart Guru. WizTech4ZC.com
New template for 2.0 viewable here: 2.0 Demo

12 Sep 2011, 7:42 PM
#8
delia avatar

delia

Totally Zenned

Join Date:
May 2006
Location:
Gardiner, Maine
Posts:
2,383
Plugin Contributions:
7

Re: creating tax exempt status for wholesale customers?

I went and looked at the logic from that exempt mod and it was similar though more complicated than I think is necessary for my specific situation.

I even took that mod and substituted in the appropriate places and no dice.

Didn't think this was going to be so difficult but I'm running in more clients who are doing both wholesale and retail in the same cart and this has to happen somehow.

The full-time Zen Cart Guru. WizTech4ZC.com
New template for 2.0 viewable here: 2.0 Demo

12 Sep 2011, 9:28 PM
#9
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: creating tax exempt status for wholesale customers?

So, are you saying that if you add a line like the following to the beginning of the zen_get_tax_rate() function, it IS showing customers_whole = 1 ?

die('$_SESSION contains: ' . print_r($_SESSION, true));

(when the customer is logged in as a wholesale customer)

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

12 Sep 2011, 9:45 PM
#10
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: creating tax exempt status for wholesale customers?

Also note, if you're seeing wrong tax stuff on checkout confirmation, you'll need to do a similar "return 0" in zen_get_multiple_tax_rates() as well.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

13 Sep 2011, 12:15 PM
#11
delia avatar

delia

Totally Zenned

Join Date:
May 2006
Location:
Gardiner, Maine
Posts:
2,383
Plugin Contributions:
7

Re: creating tax exempt status for wholesale customers?

Well, I'm going to put this on hold for the moment. The present customer I was working with opted for the tax exemption mod and I now have no way to test this out right now.

Thanks for you help - I have more tools to go with next time!

The full-time Zen Cart Guru. WizTech4ZC.com
New template for 2.0 viewable here: 2.0 Demo

7 Sep 2012, 3:02 PM
#12
mvstudio avatar

mvstudio

Zen Follower

Join Date:
Apr 2008
Posts:
447
Plugin Contributions:
1

Re: creating tax exempt status for wholesale customers?

In case anyone needs this:

add

if ($_SESSION['customer_whole'] && $_SESSION['customer_whole'] != '0' ) {
return 0;
    }  

right below

  function zen_get_tax_rate($class_id, $country_id = -1, $zone_id = -1) {
    global $db;

M.Valenti
Contemporary Artist - Entrepreneur
http://www.manuelavalenti.com - http://www.byvalenti.com

31 Oct 2012, 1:10 AM
#13
jschinnerer avatar

jschinnerer

New Zenner

Join Date:
Oct 2012
Posts:
2
Plugin Contributions:
0

Re: creating tax exempt status for wholesale customers?

mvstudio:

In case anyone needs this:

add

if ($_SESSION['customer_whole'] && $_SESSION['customer_whole'] != '0' ) {
return 0;
}

> 
> right below 
> ```php
  function zen_get_tax_rate($class_id, $country_id = -1, $zone_id = -1) {
    global $db;

As Dr. Byte mentions earlier in this thread, the same code needs to also be added further down in the same file (includes/functions/functions_taxes.php), right below this:

 function zen_get_multiple_tax_rates($class_id, $country_id, $zone_id, $tax_description=array()) {
    global $db;

In my 1.3.9h installation, with the Dual pricing - Wholesale pricing add-in used for wholesale pricing, this makes sure that sales tax is always zero for any wholesale customer.
Putting the code only in the first location will NOT cover all tax calculation situations.
This code simply checks to see if customer_whole is in the session data, and if so whether it's zero or not. If it's not zero we have a wholesale customer and so return zero (0) for tax.

17 Jan 2013, 1:10 AM
#14
able avatar

able

New Zenner

Join Date:
Dec 2012
Posts:
13
Plugin Contributions:
0

Re: creating tax exempt status for wholesale customers?

delia:

Well, I'm going to put this on hold for the moment. The present customer I was working with opted for the tax exemption mod and I now have no way to test this out right now.

I've had nothing but headache trying to get the Customer Tax Exempt mod to work. It may conflict with existing mods. I had the functions_taxes file opened up in a program (beyond compare) that is usually pretty good at letting you see 2 documents (php included) and allowing you to see what's different between them. With a click you can drop the new code right into place - theoretically. The trouble with Customer Tax Exempt is, especially with other mods like Dual Price, is you don't know for sure where to put the new code or which code to replace. Just dropping in the new code crashes my site.

Making wholesale customers exempt from taxes really shouldn't be so hard to implement. I mean it may be very difficult, but someone should have figured out an easy way long ago. It's very common to have wholesale customers who are tax exempt. I will try the mod from mvstudio and see if that's any better. I uninstalled Customer Tax Exempt.

17 Jan 2013, 4:13 AM
#15
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: creating tax exempt status for wholesale customers?

Able:

Just dropping in the new code crashes my site.
That sounds like you're using a version of the plugin designed for a different version of Zen Cart, and thus you're triggering PHP errors. And you can always look at the details of your PHP errors by looking at the /logs/ folder (or the /cache/ folder in older versions of Zen Cart): http://www.zen-cart.com/content.php?124-blank-page

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.