Add an age verification modal to any page using the 'Custom HTML Code' section.
Inside this section's settings, just drop in the following code. It's currently set up for 19 years old but if you update e.getFullYear()-19
to e.getFullYear()-21
inside hte snippet below you will be able to verify for 21 years old.
<script>!function(){var e=decodeURIComponent(document.cookie);if(-1===e.indexOf("ageVerified")){window.onload=function(){if(window.jQuery){$("body").append('<div id="age_modal" class="modal fade js-age-modal" role="dialog"> <div class="modal-dialog modal-dialog-centered"> <div class="modal-content"> <div class="modal-body pt-4"> <div class="text-center mb-4"> <h4>Can we see some ID please?</h4> <p>It\'s part of our commitment to responsible drinking.</p></div><form class="js-modal-age-form text-center mb-3"> <div class="row justify-content-center"> <div class="col-md-9 mb-4"> <label for="modal_user_age" class="text-sm mb-2">Enter your birthdate:</label> <input class="form-control js-age-datepicker" name="modal_user_age" id="modal_user_age" placeholder="Pick a date" required/> </div></div><button class="btn btn-accent js-age-modal-submit" type="submit">Enter</button> </form> </main>'),$(".js-age-modal").modal({backdrop:"static"}),$(".js-age-modal").modal("show");var e=new Date;e.setFullYear(e.getFullYear()-19),$(".js-age-datepicker").pickadate({selectYears:50,max:e,disable:[{from:e,to:new Date}]}),$(".js-age-modal-submit").on("click",function(e){e.preventDefault();const a=$(".js-modal-age-form").serializeArray()[0].value;if(!a.length)return $(".js-age-datepicker").after('<div class="invalid-feedback d-block">Please enter your birthdate.</div>'),!1;var t,o,d;o=new Date(a),d=new Date,new Number((d.getTime()-o.getTime())/31536e6).toFixed(0)>=19&&($(".js-age-modal").modal("hide"),(t=new Date).setTime(t.getTime()+7776e6),document.cookie="ageVerified=true;expires="+t.toUTCString()+NaN)})}}}}();</script>