Hire a web Developer and Designer to upgrade and boost your online presence with cutting edge Technologies

Tuesday, January 8, 2013

Magento Zip+4 Tax Calculation During Checkout – Solution Restrict Length to 5 Digits

Problem
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):
Solution
To fix the Magento Zip+4 tax calculation problem please take the follow steps:
  1. Access the site via an FTP Client
  2. Download app/code/core/Mage/Tax/Model/Resource/Calculation.php
  3. Create a new folder in the local section (this will preserve the fix during Magento upgrades): app/code/local/Mage/Tax/Model/Resource/
  4. Find the following code in Calculation.php (it should be around line 235):
    1.$postcode = $request->getPostcode();
    and replace it with
    1.$postcode = substr($request->getPostcode(),0,5);
  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:
  1. Locate Calculation.php in /app/code/core/Mage/Tax/Model/Mysql4
  2. 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.

No comments:

Post a Comment