{CODICTS} Snippets is now available

Can’t find the help you need?

WooCommerce Date of Birth Validator

The {CODICTS} Date of Birth Validator plugin adds a date-of-birth field and age-verification checkbox to the WooCommerce registration form. It enables site administrators to enforce a minimum age requirement during registration, optionally display disclaimer text with a linked terms page, and store each user’s date of birth. Users can update their DOB from the WooCommerce account page, admins can view and edit it from the user profile, and a shortcode displays any user’s date of birth on the frontend. The plugin includes role-based targeting so DOB validation can be restricted to specific user roles, with special support for MyListing/Voxel theme role tabs.

Requirements

RequirementDetails
WooCommerceMust be installed and active
MyListing / Voxel ThemeOptional — enhanced checkbox styling and role-tab integration are included when detected

No child theme required. This plugin does not override any template files. It hooks into WooCommerce’s registration and account forms, adds a WooCommerce settings tab, and registers a shortcode.

Installation & Activation

Start by downloading the plugin from the Downloads page on your dashboard on the CoDicts website.

After downloading, install and activate the plugin in WordPress by navigating to “Plugins” > “Add New” > “Upload Plugin” and selecting the downloaded zip file. Click “Install Now” and then “Activate”.

After activation, navigate to WooCommerce → Settings and click the “{CODICTS} Date of Birth Validator” tab to configure.


Key Features

FeatureDescription
Date of Birth FieldAdds a native date picker input to the WooCommerce registration form.
Age Verification CheckboxAdds an “I Am Over X” checkbox with server-side age validation against the configured minimum age.
Minimum Age EnforcementConfigurable minimum age (default 18). Registration is rejected if the user is underage.
Disclaimer TextOptional disclaimer paragraph with a link to a configurable terms/policy page.
Role-Based TargetingRestrict DOB validation to specific WordPress user roles. Especially useful with MyListing/Voxel role tabs.
Account Edit SupportUsers can update their date of birth from the WooCommerce “Edit Account” page.
Admin Profile FieldAdmins can view and edit the birthday field on any user’s profile page in the WordPress admin.
DOB Shortcode[codicts-dob] displays any user’s date of birth with optional formatting.
MyListing CompatibilityCustom checkbox styling and role-tab integration for MyListing/Voxel themes.
Translation ReadyFull internationalization support with a .pot file included.

How It Works

The plugin adds fields to three locations in your site, each with slightly different behavior:

LocationDOB FieldAge CheckboxDisclaimerValidation
WooCommerce RegistrationShown (if enabled)Shown (if enabled)Shown (if enabled)DOB required + checkbox required + age checked against minimum
WooCommerce Edit AccountShown (if enabled)HiddenHiddenDOB validated against minimum age only (no checkbox)
Admin User ProfileShown (if enabled)Not applicableNot applicableNo age validation — admin can set any date

Registration Flow

1. A visitor navigates to the WooCommerce registration page.

2. Below the standard WooCommerce fields, the DOB date input, age verification checkbox, and optional disclaimer appear.

3. If role-based targeting is configured and the theme supports role selection (e.g., MyListing role tabs), the DOB fields show or hide based on the selected role.

4. On form submission, the server validates that the DOB is provided, the checkbox is checked, and the computed age meets the minimum requirement.

5. If validation passes, the DOB and verification status are saved to the user’s profile. If validation fails, error messages are displayed.


Settings Page

Navigate to WooCommerce → Settings → {CODICTS} Date of Birth Validator.

SettingDefaultDescription
Show Date of Birth InputYesAdds a date-of-birth date picker to the WooCommerce registration form and edit account page.
Show Minimum Age RestrictionYesAdds the “I Am Over X” checkbox to the registration form and enables server-side age validation.
Select User Roles(empty — all roles)Restricts DOB validation to specific user roles. When empty, all roles are validated. Hold Ctrl/Cmd to select multiple.
Show Disclaimer TextNoDisplays a disclaimer paragraph below the age verification checkbox on the registration form.
Disclaimer Text“If you are under 18 years old you are not permitted to use this site for any reason”The disclaimer message displayed to users. Visible when the disclaimer toggle is enabled.
Select Disclaimer Page(none)Links the disclaimer text to a specific WordPress page. The page title appears as a clickable link appended to the disclaimer.
Minimum Age on Registration18The minimum age (in years) required to register. Used for both the checkbox label (“I Am Over 18”) and server-side validation.

Registration Form Fields

When configured, the following elements appear on the WooCommerce registration form:

Date of Birth Input

A native HTML date picker labeled “Birth Date”. This field is required — registration is rejected if left empty.

Age Verification Checkbox

An “I Am Over {minimum age}” checkbox (e.g., “I Am Over 18”). This is required — registration is rejected if unchecked. The age number updates automatically based on the Minimum Age setting. Even when the checkbox is checked, the plugin cross-validates the entered date of birth against the minimum age.

Note: The checkbox only appears on the registration form. It is intentionally hidden on the WooCommerce Edit Account page, where only the DOB field is shown.

Disclaimer Text

An optional paragraph below the checkbox displaying your configured message. If a Disclaimer Page is selected, the page title appears as a clickable link appended to the message, opening in a new tab.


Edit Account — Updating Date of Birth

When the DOB input is enabled, logged-in users can update their date of birth from the WooCommerce My Account → Account Details page.

The DOB field appears pre-filled with the user’s stored date of birth. The age verification checkbox and disclaimer are not shown on this page. When saved, the new date is validated against the minimum age — if the user enters a date that makes them underage, an error is displayed.


Admin User Profile — Birthday Field

When the DOB input is enabled, a “Birthday” section is added to user profile pages in the WordPress admin (Users → Edit User).

Admins can view and edit any user’s date of birth from this section. No age validation is performed on admin profile saves — admins can set any date.


Role-Based Validation

The plugin supports restricting DOB validation to specific user roles. This is particularly useful for directory themes like MyListing/Voxel where different registration roles exist (e.g., “Customer” vs. “Business Owner”).

How to Configure

1. In the settings tab, use the “Select User Roles” multiselect to choose which roles should be subject to DOB validation.

2. Hold Ctrl (or Cmd on macOS) to select multiple roles.

3. Save changes.

Behavior

ConfigurationResult
No roles selected (empty)All users see the DOB fields and are validated, regardless of role.
One or more roles selectedOnly users registering with a selected role see the DOB fields and are validated. Other roles skip DOB validation entirely.

MyListing/Voxel Role Tabs

On MyListing themes with role selection tabs during registration (e.g., “Customer” / “Business Owner”), the plugin automatically shows or hides the DOB fields based on the selected tab. When a user clicks a role tab that is not in the allowed roles, the DOB section hides. When they click a tab that is in the allowed roles, it reappears — all handled in real time without page reloads.


Shortcode

Display any user’s date of birth on the frontend:

[codicts-dob]

Attributes

AttributeDefaultDescription
idPost author IDA specific WordPress user ID whose DOB to display.
with_titletrueWhether to show the “Date of Birth:” label before the date. Set to "false" to hide the label.
formatRaw stored valuePHP date format string to customize the display (e.g., d/m/Y, F j, Y).

Examples

ShortcodeOutput
[codicts-dob]Date of Birth: 1990-07-01
[codicts-dob id="42"]Date of Birth for user ID 42
[codicts-dob with_title="false"]1990-07-01 (no label)
[codicts-dob format="d/m/Y"]Date of Birth: 01/07/1990
[codicts-dob format="F j, Y"]Date of Birth: July 1, 1990
[codicts-dob id="42" with_title="true" format="d m y"]Date of Birth: 01 07 90

If no id attribute is provided, the shortcode defaults to the current post’s author. If the user has no stored DOB, the shortcode outputs nothing.

Tip: In Voxel templates, you can combine this shortcode with Voxel’s dynamic data tags to pass the current user’s ID or post author’s ID automatically.


Example Setup — Standard WooCommerce Store

1. Activate the plugin with WooCommerce active.

2. Navigate to WooCommerce → Settings → {CODICTS} Date of Birth Validator.

3. Verify “Show Date of Birth Input” and “Show Minimum Age Restriction” are both enabled. Set “Minimum Age on Registration” to 21 (for example, for alcohol-related products).

4. Enable “Show Disclaimer Text”. Set the text to “You must be 21 years or older to purchase from this store.” Select your Terms & Conditions page in “Select Disclaimer Page.”

5. Leave “Select User Roles” empty so all registering users are validated. Save changes.

6. Visit the WooCommerce registration page. Below the standard fields, users see the Birth Date picker, an “I Am Over 21” checkbox, and the disclaimer with a link to your Terms page. If a user enters a date making them under 21 or doesn’t check the box, registration is rejected with an error message.


Example Setup — MyListing Directory with Role Tabs

1. Activate the plugin with WooCommerce and the MyListing theme active.

2. In the settings tab, enable the DOB input and minimum age restriction. Set the minimum age to 18.

3. In “Select User Roles,” select only “Customer” (or whichever role requires age verification). Leave business-owner roles unselected.

4. Save changes.

5. On the MyListing registration page with role tabs, when a user selects the “Customer” tab, the DOB fields and age checkbox appear. When they switch to the “Business Owner” tab, the DOB section hides automatically. Only Customer registrations require age verification.


Example — Displaying DOB on a Profile Page

1. Add the shortcode to a user profile template or page:

[codicts-dob format="F j, Y"]

2. On the frontend, visitors see the user’s date of birth formatted as “Date of Birth: July 1, 1990.”

3. To show only the date without the label:

[codicts-dob with_title="false" format="d/m/Y"]

Outputs: 01/07/1990


Frequently Asked Questions

Does this require a child theme?

No. The plugin does not override any template files. It hooks into WooCommerce’s form actions and adds a settings tab.

Does this require WooCommerce?

Yes. The plugin checks for WooCommerce on every page load. If WooCommerce is not active, an admin error notice is displayed and no functionality is loaded.

Where are the settings?

Navigate to WooCommerce → Settings and click the “{CODICTS} Date of Birth Validator” tab. The settings are integrated into WooCommerce, not in a separate menu.

Can I change the minimum age?

Yes. Update the “Minimum Age on Registration” field in the settings tab. The default is 18. The checkbox label automatically updates to reflect the new age (e.g., “I Am Over 21”).

How do I restrict DOB validation to specific user roles?

Use the “Select User Roles” multiselect in the settings tab. Only users registering with the selected roles will see the DOB fields and be validated. Leave empty to validate all roles.

Does the checkbox appear on the Edit Account page?

No. The age verification checkbox is intentionally hidden on the Edit Account page. Only the DOB field is shown, and it is validated against the minimum age without requiring the checkbox.

Does the plugin work with themes other than MyListing?

Yes. The core functionality (DOB field, age validation, shortcode, admin profile field) works with any theme that supports WooCommerce. MyListing-specific features (custom checkbox styling, role-tab integration) only activate when the MyListing theme is detected.

How is the age calculated?

The plugin computes age by comparing the entered birth date to the current date, calculating the difference in years. This computation happens server-side on every registration and account update.

Can I display any user’s DOB on the frontend?

Yes. Use the shortcode [codicts-dob id="42"] with the user’s WordPress ID. Without an id attribute, it defaults to the current post’s author. You can customize the format with the format attribute (e.g., format="d/m/Y").

Can admins edit a user’s date of birth?

Yes. When the DOB input is enabled, a “Birthday” section appears on user profile pages in the WordPress admin (Users → Edit User). Admins can view and update any user’s date of birth without age validation.

Is the plugin translation ready?

Yes. All user-facing strings are translatable. A .pot template file is included in the languages folder. Use a translation plugin like Loco Translate to create translations for your language.

Does the plugin create any database tables?

No. The date of birth is stored as standard WordPress user meta (birthday_field). Plugin settings are stored as individual WooCommerce options in the WordPress options table. No custom database tables are created.

What happens when the plugin is deactivated?

The DOB field, age checkbox, and disclaimer no longer appear on forms. The shortcode stops rendering. User meta (stored dates of birth) and WooCommerce settings are preserved. Reactivating the plugin restores full functionality with existing data intact.


Troubleshooting

DOB Field Not Appearing on the Registration Form

CauseSolution
WooCommerce not activeThe plugin requires WooCommerce. Install and activate WooCommerce first.
“Show Date of Birth Input” disabledNavigate to WooCommerce → Settings → {CODICTS} Date of Birth Validator and enable the setting.
Role-based targetingIf specific roles are selected in “Select User Roles,” the DOB fields only appear for those roles. Leave empty to show for all roles, or add the relevant role to the selection.
Theme doesn’t use WooCommerce hooksThe DOB field is rendered via the woocommerce_register_form action hook. If your theme uses a custom registration form that doesn’t fire this hook, the field won’t appear.

Age Verification Checkbox Not Appearing

CauseSolution
“Show Minimum Age Restriction” disabledEnable this setting in the WooCommerce settings tab.
Viewing the Edit Account pageThe checkbox is intentionally hidden on the Edit Account page by design. It only appears during registration.

Registration Rejected with Age Error

CauseSolution
User is underageThe entered date of birth makes the user younger than the configured minimum age. This is the intended behavior.
DOB field left emptyThe DOB field is required when enabled. The user must enter a date of birth.
Checkbox not checkedThe “I Am Over X” checkbox must be checked during registration when the minimum age restriction is enabled.

DOB Fields Show/Hide Incorrectly with MyListing Role Tabs

CauseSolution
Wrong roles selectedVerify the correct roles are selected in “Select User Roles.” The plugin maps MyListing role tab labels to WordPress roles — ensure the role labels match.
JavaScript errorCheck the browser console (F12 → Console) for errors. The role-tab toggle depends on jQuery and MyListing’s .role-tabs HTML structure.

Shortcode Shows Nothing

CauseSolution
User has no stored DOBThe shortcode returns empty output if the user’s birthday_field meta is empty. Ensure the user has a stored date of birth (via registration or admin profile edit).
No id attribute and no post authorWithout an id attribute, the shortcode uses the current post’s author ID. On pages without a post author (e.g., static pages), provide an explicit id.

Disclaimer Text Not Appearing

CauseSolution
“Show Disclaimer Text” disabledEnable this setting in the WooCommerce settings tab.
Viewing the Edit Account pageThe disclaimer only appears on the registration form, not on the edit account page.

“WooCommerce Plugin Not Detected” Error

WooCommerce must be installed and active. Go to Plugins → Installed Plugins to verify. The plugin does not function without WooCommerce.


For further support, visit codicts.com or contact us at support@codicts.com.

CoDicts Co., Ltd. © 2021-2026. All rights reserved