My store is located in Washington state - and we have destination based sales tax. So if I am shipping to another city I need to charge a different tax.
My first idea was to import the tax rates, but a few problems
- the DOR doesn't provide a compatible CSV
- the tax zones aren't ZIP code based
- this would have to be updated quarterly
I found an API that if you send the address it returns the tax rate. It seems like it would be the best solution to somehow plug this into LemonStand - but I don't know how I would add this into the back-end. After some tinkering here are some problems I quickly realized:
- any updates to get_tax_rates() in the Shop_TaxClass model would be overwritten when I update
- I don't know if I could access the customer's address from the Shop_TaxClass model
- It would be making a cURL call for each item individually (this wouldn't be a big problem for my case, though)
Could anyone point me in the right direction?
Page 1 of 1
Destination based tax? (WA state)
#2
Posted 01 February 2012 - 10:29 AM
Hi Bob,
I would definitely recommend using the Washington tax API if possible. You should create a custom module and use event hooks. The event hooks you need may not currently be in the core. If you can get it working, please let us know where in the core you need your hook and we will add an event there, passing the data as arguments to your callback. I would suggest an event in the beginning of calculate_taxes method, passing the cart_items and shipping_info to your hook, returning the rate or 'false' for no rate (returns null in calculate_taxes). The shipping_info should be fine for determining it's WA, I believe?
Let us know how it goes.
Thank you
I would definitely recommend using the Washington tax API if possible. You should create a custom module and use event hooks. The event hooks you need may not currently be in the core. If you can get it working, please let us know where in the core you need your hook and we will add an event there, passing the data as arguments to your callback. I would suggest an event in the beginning of calculate_taxes method, passing the cart_items and shipping_info to your hook, returning the rate or 'false' for no rate (returns null in calculate_taxes). The shipping_info should be fine for determining it's WA, I believe?
Let us know how it goes.
Thank you
#3
Posted 02 February 2012 - 01:10 PM
Ok - I have the basics of the module worked out.
I am using an event called shop:onCalculateTaxes (this doesn't currently exist in the core), which returns a tax rate (something like 0.079), or false if it's not washington. Side question: is it safe to use $shipping_info->state != 56 to check if it's WA? In other words is 56 always going to be WA?
Now I am not sure how to plug this into Shop_TaxClass, so far I just have:
Backend::$events->fireEvent('shop:onCalculateTaxes', $cart_items, $shipping_info);
up at the top, which runs, but obviously doesn't do anything. I am not sure how to incorporate my module to edit the tax information. Guidance?
I am using an event called shop:onCalculateTaxes (this doesn't currently exist in the core), which returns a tax rate (something like 0.079), or false if it's not washington. Side question: is it safe to use $shipping_info->state != 56 to check if it's WA? In other words is 56 always going to be WA?
Now I am not sure how to plug this into Shop_TaxClass, so far I just have:
Backend::$events->fireEvent('shop:onCalculateTaxes', $cart_items, $shipping_info);
up at the top, which runs, but obviously doesn't do anything. I am not sure how to incorporate my module to edit the tax information. Guidance?
#4
Posted 02 February 2012 - 01:36 PM
Jsn7821, on 02 February 2012 - 01:10 PM, said:
Ok - I have the basics of the module worked out.
I am using an event called shop:onCalculateTaxes (this doesn't currently exist in the core), which returns a tax rate (something like 0.079), or false if it's not washington. Side question: is it safe to use $shipping_info->state != 56 to check if it's WA? In other words is 56 always going to be WA?
Now I am not sure how to plug this into Shop_TaxClass, so far I just have:
Backend::$events->fireEvent('shop:onCalculateTaxes', $cart_items, $shipping_info);
up at the top, which runs, but obviously doesn't do anything. I am not sure how to incorporate my module to edit the tax information. Guidance?
I am using an event called shop:onCalculateTaxes (this doesn't currently exist in the core), which returns a tax rate (something like 0.079), or false if it's not washington. Side question: is it safe to use $shipping_info->state != 56 to check if it's WA? In other words is 56 always going to be WA?
Now I am not sure how to plug this into Shop_TaxClass, so far I just have:
Backend::$events->fireEvent('shop:onCalculateTaxes', $cart_items, $shipping_info);
up at the top, which runs, but obviously doesn't do anything. I am not sure how to incorporate my module to edit the tax information. Guidance?
You can use this instead of hardcoding 56: Shop_CountryState::create(true)->find_by_code('WA')->id;
Would you be able to post a support ticket with temporary FTP and LS credentials? We can fix up the event for you and make sure it's working properly. Of course the API usage would be up to you.
Thanks
Share this topic:
Page 1 of 1

Help













