4

We noticed that on luma template, validation of email has delayed of 2 seconds. We want to override it so it doesn't have any delay upon email field changed. Is this possible to override?

return Component.extend({
    defaults: {
        template: 'Magento_Checkout/form/element/email',
        email: checkoutData.getInputFieldEmailValue(),
        emailFocused: false,
        isLoading: false,
        isPasswordVisible: false,
        listens: {
            email: 'emailHasChanged',
            emailFocused: 'validateEmail'
        }
    },
    checkDelay: 2000,
    ...

1 Answer 1

10

This can be done by using mixin, and overriding js using requirejs-config.js

Add this to the file requirejs-config.js file which is added in view/frontend of your module/theme

var config = {
    'config': {
        'mixins': {
            'Magento_Checkout/js/view/form/element/email': {
                'Your_Module/custom': true
            }
        }
    }
}

And then in your custom.js file

define([], function () {
    'use strict';

    return function (Component) {
        return Component.extend({
            checkDelay: 1000,
        });
    }
});

Another way is you can simply override the js file, by placing the email.js file at this location of your theme -

Magento_Checkout/view/frontend/js/view/form/element/email.js
2
  • Glad could help :)
    – Gagan
    Jul 25, 2018 at 7:05
  • 1
    frontend is not required in Magento_Checkout/view/frontend/js/view/form/element/email.js
    – MagePsycho
    Sep 9, 2022 at 11:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.