The craft commerce templates have too many checkout steps for us in practice. So I have combined them.

I have moved the email field into the Address page.

But I can submit this form without ever entering an email. There is no validation on it (at this stage anyway).

How can I validate the email at this point please?

To validate the address I use this, but when adding email to it there is an error because email is not part of the Address.

    function(DefineRulesEvent $event) {
        $rules = $event->rules;
        $rules[] = [['firstName', 'lastName'], 'required'];
        $event->rules = $rules;

For info, we are not allowing user registration, its guest accounts only. No need to check if a user email exists, or have a login form or a link to checkout as guest. We just need to check the email field has been filled in.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.