gtilflm Posted June 20, 2010 Posted June 20, 2010 So, I have a couple products in which only part of the price is taxable. I need some creative thinking to try to tell OSC to only tax ___ amount for a particular product ID. To further complicate matters, I'm in WA state, so I have to calculate the tax rate based on the customer's shipping address. That side of it is already taken care of though thanks to http://addons.oscommerce.com/info/6013. Basically, that contrib. sends the customer's address to the WA Dept. of Revenue, then the Dept. of Rev. sends back the appropriate tax rate. I'm sure there are different ways to do this, but I'm not sure what's best. I've thought about.... 1.) Could there be two tax classes per product, then I could apply a "negative tax rate" to the few products this applies to. 2.) Adjust the tax rate that I get back from the Dept. of Rev. if the products_id matches one of these kinds of products. 3.) Code something into ot_tax.php (order total module) that reduces the tax amount (or rate?) if the product is one of these kinds. Any creative solutions out there for this? Thanks.
MrPhil Posted June 20, 2010 Posted June 20, 2010 An interesting problem. Would this be similar to a donation being partly tax deductible and partly not (say, part goes for a pair of tickets to a "Thank you" dinner -- a product or service you receive in return, so it's not deductible)? If just one or two items, I would modify any place that figures taxes to call a new function that looks at the product_id (and possibly the address) and returns the taxable amount. If many items, you would add a new field to the product: taxable amount (or percentage) of price. In either case, you would have to be careful to keep the numbers (price and taxable amount) in sync, as prices change. Either way, you have a (possibly smaller) taxable amount to apply taxes to, but be careful that the customer sees and is charged the full amount. Also be careful to hit all places that taxes are figured. In other words, I think option 3 would be the cleanest. All three options will require a fair amount of PHP coding, but option 3 is the least kludgy and most easily understood by the purchaser. That reminds me... you might want to expand this by using the same "taxable amount" function to display the taxable amount in the product display. That could save answering some questions.
gtilflm Posted June 20, 2010 Author Posted June 20, 2010 Phil, Thanks for the thoughts. I've thought about how to communicate this to the customer and I've got a tooltip explaining the process when a customer hovers over the tax amount during checkout. As for implementing solution #3... My php is not that great. Any ideas on where to start? Thanks.
MrPhil Posted June 20, 2010 Posted June 20, 2010 Well, if I wanted to implement such a thing, the first thing I'd do is track down every place tax is calculated. I would start by scanning the PHP code for "tax", as well as reading through all the checkout code. Once I've found all places, I'd look to see the values they're calculating tax on. Replace $price (or whatever) with taxable_amt($price, $product_id). The new function would be something along the lines of: function taxable_amt($purchase_price, $id) { switch($id) { case 123: $taxable = 137.50; break; case 456: $taxable = 29.89; break; case 789: $taxable = 1234.56; break; default: $taxable = $purchase_price; break; } if ($taxable > $purchase_price) { // output some sort of error message, also log to store administrator $taxable = $purchase_price; // charge tax on full amount until we figure out what went wrong } return $taxable; } You need to find a file to put this in, which is included/required by all files that will use taxable_amt(). application_top.php is a possibility, if you can't find anything else. Or, you can put it in its own file, and make sure that it's included in each file that calls taxable_amt(). And of course, some sort of "product ID" of consistent type needs to be available wherever this function is called. Finally, you thoroughly test your store to make sure that full tax is charged where it should be, tax is not charged where it shouldn't be, and selected items are being charged the correct reduced tax. There are other things that can be done, such as using a percentage of full price that is taxable, or subtracting a fixed non-taxable amount, or taxing only the amount over an exempt amount, or taxing the full amount but only up to a maximum amount... You can also call taxable_amt() in your product description pages, and if less than the full price, do something to print "Taxable amount: $xxx.xx" near the price paid. If many products will need to be treated this way, you would probably want to put the tax information into one or more new database fields (tax discount type flag, amount), but that's a lot more work, especially as you should put in checks to make sure that the taxable amount is "reasonable". Aren't taxes fun? If you want me to write all the code for you, please contact me offline for rates, scope, and schedule.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.