How to add a field to customer list in opencart 3

For a long time and after the frustration of adding a filed to customer list in Opencart 3, Finally, I found a way on how to do it. Here down the steps to add a custom field in customer list of Opencart, also applicable to add a custom field to a product list, order list in Opencart 3 and whatever you want to customize lists in Opencart3. Let us start.

Steps of adding a custom field in customer list in Opencart3:

First: Add this custom filed to the oc_customer database table. For example member_code

Second: Of course in customer model already include because the query read all fields by Select *,  in the following path: /Admin/model/customers.php

Third: You have to add this field to the getList function in Customers controller under Admin/controller/customer.php

Fourth: Add this filed to the header and body of the list table in the file Admin/template/customer/customers_list.twig

The fifth step which is the most important thing is to delete the cache in Opencart 3 as it prevents updating reflection, Therefore, go to the home /storage/cache/  folder and delete all its contents, also disable twig cache from Environment.php if exist then clear browser caching and refresh the page.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *