Updating Craft Commerce US tax rates from the Zip Tax API
To install Tax Rate Updater, follow these steps:
- Download & unzip the file and place the
taxrateupdater
directory into yourcraft/plugins
directory - -OR- do a
git clone [email protected]/webdna/taxrateupdater
directly into yourcraft/plugins
folder. You can then update it withgit pull
- Install plugin in the Craft Control Panel under Settings > Plugins
- The plugin folder should be named
taxrateupdater
for Craft to see it. GitHub recently started appending-master
(the branch name) to the name of the folder for zip file downloads.
Tax Rate Updater works on Craft 2.4.x and Craft 2.5.x.
This plugin is specifically linked to the Zip Tax API.
It will create / update Tax Rates for all states specified in the config, using data obtained from the Zip Tax API.
You will require an API key from Zip Tax. Once you have signed up and retrieved your key, head over to the plugin settings page in the control panel, enter you key and hit save.
To see an example of the config please check in the plugin folder in the config.php.
You can override this config in your craft config folder with a file named taxrateupdater.php
. This file should having the following format:
<?php
return array(
'states' => array( // Array of states
array( // Each state array
'state' => 'California', // Nice name for the state
'code' => 'CA', // Two letter state code
'zip' => '94111', // Zip code for the state
'category' => 'general', // Craft Commerce tax category handle to add the rate to
'include' => 0, // Boolean - whether the tax is included in the price of the products
'taxable' => 'price' // Where the tax rate should apply, on the item, the shipping or both. Options: price, shipping, price_shipping
)
)
);
To initiate the updating / creating of tax rates simply hit the url YOUR_DOMAIN/actions/taxRateUpdater
. This then goes ahead an creates the tasks that will update the rates
Some things to do, and ideas for potential features:
- Allow different APIs
Brought to you by webdna