1

I want to set the default payment Credit Card option on the checkout page.

enter image description here

Please help.

1

The Magento built-in payment methods don't support the ability to select a default payment.

But, if you have custom payment method and if your custom js component extends Magento\Checkout\view\frontend\web\js\view\payment\default.js, you can use selectPaymentMethod method to set your payment as the default one.

define(['Magento_Checkout/js/view/payment/default'], function(Component) {
    initObservable: function () {
        this._super();
        this.selectPaymentMethod();
        ...
    }
});

If your payment js component has lazy initialization, you should call selectPaymentMethod on some onReady event.

| improve this answer | |
  • Please let me know we need to create a new js file. – Masud Shaikh Feb 28 at 10:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.