Cannot Disable Default Credit Card

 customers cannot disable the Make this my default credit card option. This issue occurs when a customer has only one credit card set up as their payment method. In this case, your Commerce website should display a message to inform the customer that a default payment method is required and so their single credit card must remain the default.

 Create the Override File
               {{#if showDefaults}}
   <div class="creditcard-edit-form">
      <label class="creditcard-edit-form-checkbox">
         <input
            type="checkbox"
            id="ccdefault"
            value="T"
            data-unchecked-value="F"
            name="ccdefault"
            {{#if ccdefault}} checked {{/if}}
         >
         {{translate 'Make this my default credit card'}}
      </label>
   </div>
   {{/if}} 

   And replace it with the following code:
            {{#if showDefaults}}
    <div class="creditcard-edit-form">
        <label class="creditcard-edit-form-checkbox">
            <input
                type="checkbox"
                id="ccdefault"
                value="T"
                data-unchecked-value="F"
                name="ccdefault"
                {{#if ccdefault}} checked disabled {{/if}}
            >
            {{translate 'Make this my default credit card'}}

            {{#if ccdefault}} <i class="creditcard-default-icon" data-toggle="tooltip" title="{{translate 'You need to have at least one card selected by default'}}"></i> {{/if}}
        </label>
    </div>
{{/if}} 

Test and Deploy Your Patch                 

Leave a comment

Your email address will not be published. Required fields are marked *