Hardly worth adding this to the plugins, hence offering the code here.
[I'm hoping 'minimum age' will show in the search results if searched for.]
If you want to restrict your store to a minimum age (18 shown below).
First copy the file
\includes\modules\create_account.php
to
\includes\modules\[your-template]\create_account.php
then modify it with the following code
PHP Code:
/*
if (ACCOUNT_DOB == 'true') {
if (ENTRY_DOB_MIN_LENGTH > 0 or !empty($_POST['dob'])) {
if (substr_count($dob,'/') > 2 || checkdate((int)substr(zen_date_raw($dob), 4, 2), (int)substr(zen_date_raw($dob), 6, 2), (int)substr(zen_date_raw($dob), 0, 4)) == false) {
$error = true;
$messageStack->add('create_account', ENTRY_DATE_OF_BIRTH_ERROR);
}
}
}
*/
if (ACCOUNT_DOB == 'true') {
if (ENTRY_DOB_MIN_LENGTH > 0 or !empty($_POST['dob'])) {
if (substr_count($dob,'/') > 2 || checkdate((int)substr(zen_date_raw($dob), 4, 2), (int)substr(zen_date_raw($dob), 6, 2), (int)substr(zen_date_raw($dob), 0, 4)) == false) {
$error = true;
$messageStack->add('create_account', ENTRY_DATE_OF_BIRTH_ERROR);
}
$minimum_age = 18;
$acceptable_dob = (date('Y') - $minimum_age) . date('md');
if (zen_date_raw($dob) > $acceptable_dob) {
$error = true;
// $messageStack->add('create_account', ENTRY_DATE_OF_BIRTH_UNDERAGE);
$messageStack->add('create_account', 'YOU MUST BE AT LEAST EIGHTEEN (18) years of age in order to purchase ANY PRODUCT from our store.');
}
}
}
Change the value of the variable to apply the age restriction that you require.
That's it.
Unfortunately PayPal won't verify the 'age' during checkout, their reasons are that they have to consider their customer's privacy!!!
So it's not a complete solution if you sell age restricted items ~ there are companies out there that do offer verification for a fee.
Adding a define statement
PHP Code:
ENTRY_DATE_OF_BIRTH_UNDERAGE
is not strictly necessary, I just threw it in there for your reference.
Hope this is helpful.