2

In Magento 2.1.7 when arrive to the payment checkout there is a line for the terms: I accept the terms and conditions but there is no checkbox.

When I click on pay button it displays an error message that I have to accept the terms, but I can't accept them without checkbox!

In

magento_root/vendor/magento/module-checkout-agreements/view/frontend/web/template/checkout/checkout-agreements.html 

can see the code:

<div data-role="checkout-agreements">
<div class="checkout-agreements" data-bind="visible: isVisible">
    <!-- ko foreach: agreements -->
        <!-- ko if: ($parent.isAgreementRequired($data)) -->
        <div class="checkout-agreement">
            <input type="checkbox"
                   data-bind="attr: {
                                'id': 'agreement_' + agreementId,
                                'name': 'agreement[' + agreementId + ']',
                                'value': agreementId
                                }"
                   data-validate="{required:true}" />
            <label data-bind="attr: {'for': 'agreement_' + agreementId}">
                <button type="button"
                        class="action action-show"
                        data-bind="click: function(data, event) { return $parent.showContent(data, event) }"
                        >
                    <span data-bind="html: checkboxText"></span>
                </button>
            </label>
        </div>
        <!-- /ko -->
        <!-- ko ifnot: ($parent.isAgreementRequired($data)) -->
        <div class="checkout-agreement">
            <button type="button" class="action action-show"
                    data-bind="click: function(data, event) { return $parent.showContent(data, event) }">
                <span data-bind="html: checkboxText"></span>
            </button>
        </div>
        <!-- /ko -->
    <!-- /ko -->
    <div id="checkout-agreements-modal" data-bind="afterRender: initModal" style="display: none">
        <div class="checkout-agreements-item-content" data-bind="html: modalContent"></div>
    </div>
</div>

but in the web there is:

<div data-role="checkout-agreements">
<div class="checkout-agreements" data-bind="visible: isVisible">
    <!-- ko foreach: agreements -->
        <!-- ko if: ($parent.isAgreementRequired($data)) --><!-- /ko -->
        <!-- ko ifnot: ($parent.isAgreementRequired($data)) -->
        <div class="checkout-agreement">
            <button type="button" class="action action-show" data-bind="click: function(data, event) { return $parent.showContent(data, event) }">
                <span data-bind="html: checkboxText">I accept terms and conditions</span>
            </button>
        </div>
        <!-- /ko -->
    <!-- /ko -->

</div>

So all the code that references the checkbox input is missing.

I have configured in admin panel -> stores/terms and conditions the terms with status enabled and applied automatically.

I have configured in admin panel -> stores/configuration/sales/order/payment process options the terms and conditions enabled.

As I configured the terms and conditions in both places it should display the checkbox, but there is no checkbox.

Is like the ko if: ($parent.isAgreementRequired($data)) is false always.

I cleared the cache several times: php bin/magento cache:flush

I reindexed: php bin/magento indexer:reindex

I made a setup upgrade, setup di compile and setup deploy static but still no checkbox.

Finally I tried disabling all the terms and conditions, but still can't pay. Not sure what's happening as the code of the checkout remains untouched yet.

3 Answers 3

6

You have to go in Store Menu > Sales Checkout Agreements

  • Select the agreements terms you want to make required by clicking on its row
  • In the Apply combobox(select) : select the Manually option.

Then refresh your checkout_index_index page (checkout OPC) and you'll see the checkbox before the "Checkbox text".

The Apply option makes the Terms auto accept if automatic or Need to check the checkbox if manually ;)

2
  • Please check this issue code too, you need to create your own - Magento_CheckoutAgreements/web/js/checkout-agreements.js and - Magento_CheckoutAgreements/web/template/checkout/checkout-agreements.html in your theme, cuse if you use multiple payment methods you'll be stucked by a non fixed issue of unique checkbox ID. Check the code here : (replace entire file in your custom theme) github.com/magento/magento2/commit/…
    – aribeiro
    Sep 8, 2017 at 13:16
  • I have enabled terms and conditions but after that not able to place order if selected checkbox. Dec 7, 2018 at 15:09
4

In the Magento Stores->Setting->Terms and Conditions open the your condition and in applied field dropdown you can set the Manually than you are get the checkbox at the frontend.

if not get than run the commnad

php bin/magento cache:clean
0

I have resolved this issue in the blank theme by adding 20px to the CSS box in: Stores -> Terms and Conditions -> You Terms.

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.