Skip to content

magento 2.4.5 set checked default checkbox

We have the following module in the vendor extending html

vendor/GB/module-payment

view/frontend/requirejs-config.js

const config = {
config: {
    mixins: {
        'VndorPayment_Magento2/js/view/payment/method-renderer/cc': {
            'GB_Payment/js/view/payment/method-renderer/cc-mixin': true
        },

in js

js/view/payment/method-renderer/cc-mixin

define([], function () {
'use strict';

return function (CreditCard) {
    return CreditCard.extend({
        defaults: {
            template: 'GB_Payment/payment/cc'
        }
    });
};

});

view/frontend/web/template/payment/cc.html

...
<div class="control">
                    <input type="checkbox" name="cc_terms" class="checkbox" value=""
                           data-bind="attr: {
                                                autocomplete: off,
                                                id: getCode() + '_terms',
                                                'data-container': getCode() + '-terms',
                                                'data-validate': JSON.stringify({'validate-terms':'#' + getCode() + '_terms'})
                                            }"/>
                    <span data-bind="html: getTermsHtml()"></span>
                </div>
...

How do I set the checkbox field to default checked?
I tried overriding or via js in cehckout_index_index afterRender and it didn’t work