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.
Best Answer
You have to go in
Store Menu > Sales Checkout Agreements
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 ;)