In Opencart 4 we can add custom fields in the account section, address section and affiliate section. When you add the custom fields in the account section then it will show the fields in the registration form and shows it when customer edit their information and similar for the address and affiliate section.
Example of the custom field in the registration form
Let’s say we want to know the size of the customer while they register so that we can target our marketing efforts with their sizes of products. When you add the custom radio field then it may look like below in the registration form:
You can see the custom filed similar to below when the customer edits their personal detail.
How to add the custom fields in Opencart?
Opencart 4 supports custom fields only for customer or account, address, and affiliate. Log into admin >> Customers >> Custom fields >> then you can see the custom field list, where you can add and delete the custom field.
Click the blue-button to add the custom field then you will see a form like below. The location field is the one you will select where you want to show the field. You can show the field on the account section, address section and affiliate section. We have a “Contact us” form also but we cannot add a custom field on Contact us form for now. We will soon write a post on how to add the custom field to the contact us form.
Now see the field Type where you can select the type of field, you can select: Select field or Radio field or Checkbox field or Text field or Textarea field or File field or Date field or Time field or Date & Time field. For our above example, we select the Select field.
Then you can see a section where you can add custom field values for select field option like below:
Then, you choose other options like which customer group to show, whether it is required or not, select the status to Enabled and add the sort order. Use minus to count backward from the last field in the set to show above the field as for sorting the field. Once you set all of these options then save it and your custom fields are shown in the front end and backend.
In this way, you can add custom fields in Opencart 4 for customers, addresses, and affiliates. Please don’t forget to post your questions or comments so that we can add extra topics. You can follow us at our twitter account @rupaknpl. Subscribe to our YouTube channel for Opencart tutorials, and click to see all Opencart user manual.
Hello,
I want Custom Field should not be editable to customer/affiliate account when they logged in.
Is that is possible? Read-only Custom Field required.