I've added a second checkbox to terms and conditions, but that is not validating.

What I've done:

I've serached and found that, iIt was or is still an magneto2 bug, but found this: https://github.com/bka/magento2/blob/6d172c93a8deaccb0b5d1449cd3b7dc6fc9e8626/app/code/Magento/CheckoutAgreements/view/frontend/web/js/model/agreement-validator.js I've added this code but it isn't working.

After adding the code I tried following command:

php bin/magento setup:static-content:deploy
php bin/magento indexer:reindex
php bin/magento cache:clean
php bin/magento cache:flush

It's still not working.

Can Someone help with adding exact code that I have to replace?

Thanks in advance.


We have face the same issue(terms and conditions not validating) in our system, and change the below mentioned code. Now working properly.

File Path:


Change the below code:

 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
/*jshint browser:true jquery:true*/
/*global alert*/
    function ($) {
        'use strict';
        var checkoutConfig = window.checkoutConfig,
            agreementsConfig = checkoutConfig ? checkoutConfig.checkoutAgreements : {};

        var agreementsInputPath = '.payment-method._active div.checkout-agreements input';

        return {
             * Validate checkout agreements
             * @returns {boolean}
            validate: function() {
                var noError = true;
                if (!agreementsConfig.isEnabled || $(agreementsInputPath).length == 0) {
                    return noError;

                $('.payment-method:not(._active) div.checkout-agreements input')
                    .prop('checked', false)

                $(agreementsInputPath).each(function() {
                    var name = $(this).attr('name');

                    var result = $('#co-payment-form').validate({
                        errorClass: 'mage-error',
                        errorElement: 'div',
                        meta: 'validate',
                        errorPlacement: function (error, element) {
                            var errorPlacement = element;
                            if (element.is(':checkbox') || element.is(':radio')) {
                                errorPlacement = element.siblings('label').last();
                    }).element(agreementsInputPath + '[name="' + name + '"]');

                    if (!result) {
                        noError = false;

                return noError;

After changed the code you will following command:

php bin/magento setup:static-content:deploy
php bin/magento cache:clean
php bin/magento cache:flush
|improve this answer|||||
  • hi @Sankar, tried this solution didn't work for me – jafar pinjar Dec 11 '18 at 8:34
  • @jafarpinjar Your magento version?? – Sankar_k Dec 12 '18 at 11:57
  • I am using 2.2.4 – jafar pinjar Dec 12 '18 at 12:04

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.