on November 14, 2012
There is a bug in Magento that prevents Zip+4 tax codes from accurately being calculated. If a customer enters their zip code during Magento checkout in the Zip+4 format (XXXXX-XXXX) or makes a typo during entry, i.e. includes an extra or non-digit character, any applicable taxes are not calculated by Magento. This causes headaches for orders where tax should have been collected: following up with customers, running additional charges, and keeping track of these manual tax collections is an inconvenience for business owners and customers alike.
Since the solution to this problem is not well-documented by the Magento community, we have posted it below for others to refer to. Plus note that the instructions are for Magento 1.7.x (see the bottom of the post for info about applying this fix in Magento 1.4.x):
To fix the Magento Zip+4 tax calculation problem please take the follow steps:
- Access the site via an FTP Client
- Download app/code/core/Mage/Tax/Model/Resource/Calculation.php
- Create a new folder in the local section (this will preserve the fix during Magento upgrades): app/code/local/Mage/Tax/Model/Resource/
- Find the following code in Calculation.php (it should be around line 235):
$postcode = $request->getPostcode();
and replace it with
$postcode = substr($request->getPostcode(),0,5);
- Save Calculation.php and upload it to the new folder created in Step 3 app/code/local/Mage/Tax/Model/Resource/
Once the file has been uploaded the Magento zip+4 tax calculation issue should be fixed, remember to test checkout with a taxable address to verify that it is indeed working.
Fixing the Zip+4 Tax Calculation Issue in Magento 1.4x
The file structure in Magento 1.4.x differs from 1.7.x, so for the above steps you will need to:
- Locate Calculation.php in /app/code/core/Mage/Tax/Model/Mysql4
- Replace the /Resource/ directory with the /Mysql14/ directory
If you have any questions regarding this Magento tax+4 (or tax4) calculation issue, please leave a comment on this post and we will respond.