githubEdit

Custom Fields

Guide to creating and managing custom form fields for customers in OpenCart 4

circle-info

Extended Customer Information Custom Fields allow you to collect additional information from customers beyond the standard registration form, tailored to your specific business needs.

Introduction

Custom Fields in OpenCart 4 enable you to extend the customer registration and profile forms with additional fields. This powerful feature allows you to collect specific information relevant to your business, such as company details, preferences, or regulatory requirements.

Accessing Custom Fields

To access the Custom Fields interface:

  1. Log in to your OpenCart admin panel

  2. Navigate to Customers → Custom Fields

  3. You'll see the custom field list with existing fields

Custom Fields List

Field Types Available

OpenCart 4 supports several custom field types:

Field Type
Description
Use Case

Text

Single-line text input

Short answers, names, identifiers

Textarea

Multi-line text input

Descriptions, comments, addresses

Select

Dropdown selection

Choices from predefined options

Radio

Radio button group

Single choice from options

Checkbox

Checkbox group

Multiple selections from options

File

File upload

Documents, images, certificates

Date

Date picker

Birth dates, event dates

Time

Time picker

Appointment times, preferences

Datetime

Date and time picker

Meeting schedules, deadlines

Creating a New Custom Field

1

Step 1: Click Add New

Click the Add New button (+) in the top-right corner of the custom field list.

2

Step 2: Configure Field Settings

Fill in the custom field configuration form:

Field Information

circle-info

Field Name & Location 📝

  • Field Name: Required, descriptive name shown to customers, multilingual support

  • Location: Determines where the field appears:

    • Account - Customer registration and profile forms

    • Address - Address entry forms (shipping/billing)

    • Affiliate - Affiliate registration and profile

Field Type & Validation

circle-exclamation
Custom Field Form
3

Step 3: Configure Field Values (for Select/Radio/Checkbox)

For selection-based fields, configure the available options:

  1. Click Add Value

  2. Enter option details:

    • Value Name - Display text for the option (multilingual)

    • Sort Order - Display order (lower numbers appear first)

circle-check
Field Values Configuration
4

Step 4: Assign to Customer Groups

Specify which customer groups see this field:

  • All Customer Groups - Field appears for all groups (default)

  • Specific Groups - Select individual groups from the list

circle-info

Targeted Field Display 🎯

Use customer group assignments to show relevant fields to specific customer segments. For example, show business-related fields only to wholesale customers.

5

Step 5: Set Display Order

  • Sort Order - Controls display order relative to other fields

  • Lower numbers appear first in forms

circle-check
6

Step 6: Save the Field

Click Save to create the custom field. You'll see a success message confirming the field has been created.

circle-check

Field Configuration Details

chevron-rightField Namehashtag
  • Required: Yes

  • Multilingual: Supports multiple languages for international stores

  • Customer-facing: Shown as field label in forms

chevron-rightLocationhashtag

Determines where the field appears:

Location
Forms Where Field Appears

Account

Registration, login, customer profile edit

Address

Address entry forms (shipping/billing)

Affiliate

Affiliate registration and profile

chevron-rightType-Specific Configurationhashtag

chevron-rightCustomer Group Assignmenthashtag

Control which customer groups see each field:

  • All Groups - Field appears for everyone (default)

  • Specific Groups - Field only appears for selected groups

  • No Groups - Field hidden (useful for temporary disabling)

Customer Group Assignment

Use Cases for Custom Fields

chevron-right1. Business Customer Information 🏢hashtag

Collect company details for B2B customers:

  • Company Name (Text field)

  • VAT Number (Text with validation)

  • Company Type (Select: LLC, Corporation, Partnership, etc.)

  • Business Registration Number (Text)

  • Industry Sector (Select or Radio)

chevron-right2. Customer Preferences ❤️hashtag

Gather preferences for personalized service:

  • Newsletter Preferences (Checkbox: Weekly, Monthly, Promotions, New Arrivals)

  • Contact Method (Radio: Email, Phone, SMS, Mail)

  • Product Interests (Checkbox: Categories, brands, product types)

  • Communication Frequency (Select: Daily, Weekly, Monthly)

chevron-right3. Regulatory Compliance 📋hashtag

Collect required information for legal compliance:

  • Age Verification (Date of Birth with minimum age validation)

  • Tax Exemption Status (Select: Yes/No with certificate upload field)

  • Industry Classification (Select: Standard industry codes like NAICS, SIC)

  • GDPR Consent (Checkbox for privacy policy acceptance)

chevron-right4. Shipping & Delivery 📦hashtag

Additional address information for delivery optimization:

  • Delivery Instructions (Textarea for special instructions)

  • Access Codes (Text for building/security codes)

  • Preferred Delivery Time (Select: Morning, Afternoon, Evening, Any)

  • Delivery Location (Radio: Front Door, Back Door, Reception, Mailroom)

chevron-right5. Membership & Loyalty 🥇hashtag

Information for loyalty programs and membership management:

  • Membership Number (Text with unique validation)

  • Referral Source (Select: Friend, Social Media, Search Engine, Advertisement)

  • Anniversary Date (Date for membership anniversary)

  • Loyalty Tier (Select: Bronze, Silver, Gold, Platinum)

Managing Existing Custom Fields

Editing a Field

  1. From the custom field list, click Edit (pencil icon)

  2. Modify field settings as needed

  3. Click Save to update

circle-exclamation

Deleting a Field

  1. From the custom field list, click Delete (trash icon)

  2. Confirm deletion in the pop-up dialog

triangle-exclamation

Reordering Fields

Adjust the Sort Order value to control display order. Fields with lower sort order numbers appear first in forms.

circle-info

Sort Order Tips 🔢

  • Use increments of 10 (0, 10, 20, etc.) to allow easy insertion of new fields

  • Group related fields with consecutive numbers

  • Test form appearance after reordering

Integration with Other Features

chevron-rightCustomer Groups 🎯hashtag

Custom fields can be assigned to specific customer groups, allowing different information collection for different customer segments.

  • Targeted Data Collection: Show business fields only to wholesale groups

  • Progressive Disclosure: Reduce form complexity by showing relevant fields

  • Group-Specific Validation: Different validation rules per customer group

chevron-rightCustomer Approval ✅hashtag

Custom field data appears in the approval review process, providing additional information for decision-making.

  • Enhanced Review: View custom field data during customer approval

  • Automated Decisions: Use custom field values for automatic approval rules

  • Documentation: Attach uploaded files (certificates, documents) to approval requests

chevron-rightCustomer Management 👤hashtag

Custom field values appear in customer profiles and can be edited by administrators.

  • Complete Customer View: See all custom field data in customer profiles

  • Administrative Editing: Update custom field values for customers

  • Data Export: Include custom field data in customer exports

chevron-rightRegistration Forms 📝hashtag

Custom fields integrate seamlessly into registration forms based on their assigned location and customer group.

  • Automatic Placement: Fields appear in correct form sections automatically

  • Conditional Display: Show/hide fields based on customer group selection

  • Mobile Responsive: Custom fields work well on all device types

Best Practices

circle-check
circle-exclamation
circle-info

User Experience Optimization 📱

  1. Progressive Disclosure: Use customer group assignments to show relevant fields only

  2. Default Values: Pre-fill fields where appropriate to reduce customer effort

  3. Mobile Optimization: Ensure fields work well on mobile devices with touch-friendly interfaces

Troubleshooting

Common Issues

chevron-rightField not appearing in form 🔍hashtag

Possible Causes:

  • Field not assigned to customer group

  • Incorrect location setting

  • Field disabled (sort order set to hidden)

Solutions:

  1. Check customer group assignment in field settings

  2. Verify location matches intended form (Account, Address, Affiliate)

  3. Ensure sort order is set (not empty or negative)

chevron-rightValidation errors ⚠️hashtag

Possible Causes:

  • Input doesn't match field type (e.g., text in email field)

  • Required field left empty

  • Custom regex pattern mismatch

Solutions:

  1. Verify field configuration matches expected input type

  2. Check if field is marked as required

  3. Test validation rules with sample data

chevron-rightFile uploads failing 📎hashtag

Possible Causes:

  • File type not allowed

  • File size exceeds limit

  • Server permissions or storage issues

Solutions:

  1. Check allowed file types in field settings

  2. Verify maximum file size limit

  3. Ensure server upload directory has proper permissions

chevron-rightData not saving 💾hashtag

Possible Causes:

  • Required field validation failing

  • Database constraints or limits

  • Form submission errors

Solutions:

  1. Check if field is marked as required but left empty

  2. Verify database connection and table structure

  3. Test with different browsers/devices

circle-info

Performance Considerations

  • Large numbers of custom fields can slow down registration and profile forms

  • File upload fields require adequate server storage and bandwidth

  • Complex validation rules may impact form submission performance

  • Consider pagination or progressive loading for forms with many fields

Security Considerations

Data Privacy 🔒

  • Only collect necessary information

  • Clearly explain how data will be used

  • Comply with GDPR and other privacy regulations

File Upload Security 📎

  • Restrict allowed file types to prevent malicious uploads

  • Implement virus scanning for uploaded files

  • Store uploaded files in secure, non-web-accessible locations

Input Validation 🛡️

  • Validate all user input to prevent injection attacks

  • Sanitize data before storage

  • Implement server-side validation in addition to client-side

circle-check

Last updated