0

In Magento 2.4, Checkout page I faced error.

TypeError : Unable to process binding "afterRender: function () {return renderReCaptcha() }"

How to solve this error?

1 Answer 1

1

Create requiejs-config.js file and add this mixin :

app/code/Vendor/Module/view/frontend/requirejs-config.js

var config = {
    config: {
        mixins: {
            'Magento_ReCaptchaFrontendUi/js/reCaptcha' : {
                'Vendor_Module/js/reCaptcha-mixin' : true
            }
        }
    }
};

Create reCaptcha-mixin.js file and add below code :

app/code/Vendor/Module/view/frontend/web/js/reCaptcha-mixin.js

define([
    'uiComponent',
    'jquery',
    'ko',
    'underscore',
    'Magento_ReCaptchaFrontendUi/js/registry',
    'Magento_ReCaptchaFrontendUi/js/reCaptchaScriptLoader',
    'Magento_ReCaptchaFrontendUi/js/nonInlineReCaptchaRenderer'
], function (Component, $, ko, _, registry, reCaptchaLoader, nonInlineReCaptchaRenderer) {
    'use strict';

    return function(Component) {
        return Component.extend({
            initCaptcha: function () {
                if (typeof this.settings === 'undefined') { 
                    return; 
                }
                this._super();
            },
            
            getIsInvisibleRecaptcha: function () {
                if (typeof this.settings === 'undefined') { 
                    return; 
                }
                return this.settings.invisible;
            }
        });   
    }
});

Now, Just need to deploy and clean cache.

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.