I don’t see any references to how to tie into the customization for page.validating
as per the prior API version v2: How to Make Phone Number on The Billing Address Tab a Required Field (Not Custom Field)
It seems that this event no longer exists, and if that’s the case how would I go about creating an event (or similar) to validate a custom field such as a phone number:
Snipcart.events.on('page.validating', function (data) {
if (data.phone.length < 3) {
ev.addError('phone', 'Please enter a phone number');
}
});
Alternatively as a back-up for the time being, I simply have the required
attribute as part of the HTML in the Snipcart template for the phone number input. However, this causes style discrepancies on validation and it doesn’t allow me to validate the phone number via regex or other libraries.