magento 2 – Terms and conditions checkbox on register page

The question:

I want to set terms and conditions checkbox on register page which retrieve same as checkout.

On click of terms and conditions link open content in popup.

Any suggestion would be appreciated.


The Solutions:

Below are the methods you can try. The first solution is probably the best. Try others if the first one doesn’t work. Senior developers aren’t just copying/pasting – they read the methods carefully & apply them wisely to each case.

Method 1

Change in following files:
(Append below code)

     if (!$block->getAgreements()) {

        /** @var MagentoCheckoutAgreementsModelResourceModelAgreementCollection $argeementsCollection */
        $argeementsCollection = $block->getAgreements();
        $agreementMappedArray = [];
        /** @var MagentoCheckoutAgreementsModelAgreement $agreement */
        foreach ($argeementsCollection as $agreement) {
            if ($agreement->getIsActive()) {
                $agreementMappedArray[] = [
                    'mode' => $agreement->getMode(),
                    'agreementId' => $agreement->getAgreementId(),
                    'checkboxText' => $agreement->getCheckboxText(),
                    'content' => $agreement->getContent()
        $agreementJson = json_encode($agreementMappedArray);
        <div data-bind="scope: 'checkout-agreements-component-scope'" class="checkout-agreements-block">
        <!-- ko template: getTemplate() --><!-- /ko -->

Add below script :

 <script type="text/x-magento-init">
    "*": {
        "Magento_Ui/js/core/app": {
            "components": {
                "checkout-agreements-component-scope": {
                    "component": "Magento_CheckoutAgreements/js/view/checkout-agreements",
                    "agreements": <?php /* @noEscape */ echo $agreementJson; ?>,
                    "isVisible": true

Note : Override form/phtml file into your module, Don’t change in core module directly.

Method 2

These answers might be more fitting if you don’t want to fight with bugs:
Adding a required unchecked check box for Terms and Conditions on new account registration

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Comment