For websites selling age-restricted products, such as alcohol, cannabis, or smoking-related products, age verification is required for visitors before entering the website. A process is called Age Gate.
In WordPress, it could be achieved easily by implementing an Age Gate plugin and there are tons of them available, mostly free of charge. Some may be better than other but functionality-wise, they are all doing one thing, putting an Age Gate verification on the website, either by verifying your birthday or getting the consent that you are above certain legal age.
But none of them are compliant in Canadian market.
In Canada, the legal age for purchasing certain products may vary between provinces. For example, the legal age to purchase cannabis in British Columbia is 18 but could be 19 in Alberta or 21 in Quebec. Therefore, a single birthday verification across board won’t be enough, nor is a simply Yes/No answer.
Phil, the author of the popular Age Gate plugin, shared an add-on in a WordPress support post that adds a dropdown list for all provinces for multiple age verification options. It works almost out of the box but does require a bit of adjustment to make it work on your own website.
There are only two files in the plugin:
- age-gate-canadian-province.php and
There’s an array of the provinces with an age, just change these to match the legal needs. By default, Yukon is currently set to be 65! And you can use it mainly for test purpose.
By default, the Province dropdown list is located below the birthday selectors. If you need to move it up, replace the line 34 with the following line:
add_filter('pre_age_gate_custom_fields', 'ag_province_list', 10, 1);
After some styling twist, you should have a stylish age-gate that works perfectly in the Canadian market.