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,
    ...
9

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
| improve this answer | |
  • Glad could help :) – Gagan Jul 25 '18 at 7:05

Your Answer

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

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