Restoring the Tax ID to Customer Data in OpenCart 2.x and Above

When upgrading from OpenCart 1.5 to a newer version there are some significant changes. One that we recently dealt with for a client was restoring the Tax ID field that was previously available as part of the information entered during checkout by customers and was removed in OpenCart 2.0. There two steps to accomplish this.

The first step is to restore the Tax ID field to the customer data and to checkout. That can be done by creating a custom field, which can be done from the Customers menu in the admin area of OpenCart. You are provided with a number of options when setting up a new custom field, including what customer groups you wish it to be shown to:

The second step is to copy over the existing Tax IDs to the new custom field. The existing Tax IDs are stored in the tax_id column of the address table in the database and the custom field in the custom_field column in the customer table. Because of the formatting used for the custom_field column you cannot simply copy over the values from one to the other. The simpler method technically to copy the data is to enter the values from the tax_id column in to the customer’s details in the admin area. For those technically minded you can use a bit of coding to get the values from the one column, convert them to the formatting for the second, and then copy them over.

Leave a Reply

Your email address will not be published.